Q:

Skipping WHERE statement if the variable for that statement is null

I will have a table
TABLE1
ID  Name   Country
1   Anna   Singapore
2   Brad   UK
3   Cassie US

declare @place varchar(20);
set @place='US';

select * from Table1 where country=@place;

what if the value is @place is null??? 
then, the select will not select anything..
what I want is to treat as there is no where statement for country.  while if there's other where statements, they will work..
Any idea how to do that?? 

A:

For this simple case in your question just use
IF ( @place IS NULL )
  SELECT *
  FROM   table1
ELSE
  SELECT *
  FROM   table1
  WHERE  country = @place  

If your actual situation is more complex you could use
select * 
from Table1 
where @place is null or country=@place 
option (recompile)

The reason for needing the recompile hint is to avoid having a single plan catering for both cases and doing an unnecessary scan in the event that you do supply an explicit value.  
These, and other alternatives such as generating the query dynamically, are discussed in detail in the article Dynamic Search Conditions in T-SQL

