Click here to Skip to main content
16,017,707 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi,

my parameters are optional .i can select any parameters . kindly tel me the syntax should be used in WHERE condition.

Regards
shanif

[edit]Urgency deleted - OriginalGriff[/edit]
Posted
Updated 21-May-13 2:24am
v2
Comments
Joezer BH 21-May-13 8:21am    
Show some code buddy, just to get us oriented ;)
OriginalGriff 21-May-13 8:24am    
Urgency deleted: It may be urgent to you, but it isn't to us. All that your stressing the urgency does is to make us think you have left it too late, and want us to do it for you. This annoys some people, and can slow a response.

This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.

Well if I understand what you're saying, then you only want to do the WHERE when either both of your dates values are not null OR the country value is not null, so try something like:

SQL
WHERE  ((tm.TrnDteRcvDate != null AND tm.trndtedate != null) 
       AND (CAST(CONVERT(VARCHAR, tm.TrnDteRcvDate, 101) AS DATETIME) 
              BETWEEN '01/19/2010' AND '01/20/2010')
       AND (CAST(CONVERT(VARCHAR,tm.trndtedate,101) AS DATETIME) 
              BETWEEN '1/9/2010' AND '1/9/2010'))
       OR (InvVarCoun != null AND InvVarCoun='United States')
 
Share this answer
 
v3
SELECT COLUMN_NM FROM TABLE_NM WHERE COLUMN _NM =VALUE ORDER BY COLUMN_NM ASC
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900