Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
shantanu88d
Starting Member
35 Posts |
Posted - 2011-05-13 : 03:53:55
|
| Hi,I have a table with entry_date column.Now I want a query that will take entry_date as parameter. But if entry_date is passed as null, the query will still show all the records. How to achieve this ? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-05-13 : 04:05:12
|
[code]where @entry_date is nullor entry_date = @entry_date[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
shantanu88d
Starting Member
35 Posts |
Posted - 2011-05-13 : 04:57:08
|
Hey, awesome, thanks for the soultionThere are no failures...only experiences! |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2011-05-13 : 07:08:15
|
howzabout...where entry_date = COALESCE(@entry_date,entry_date) Yes, i am going for the bad/confusing code. Practicing to be a consultant!http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
|
|
|