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 |
|
ranganath
Posting Yak Master
209 Posts |
Posted - 2008-03-01 : 01:38:31
|
| Hi,i have an input parameter @PageloadYN Bit Nullif @PageloadYN = 1 then Select top 500 Records from the Tableif @PageloadYN = 0 then Select * from the Tablei tried like this Select top 500.* From Table where @PageloadYN = 1Select * From Table where @PageloadYN = 0Is there any way to get details in Single select statement only. |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2008-03-01 : 02:14:17
|
You can do it in a single SELECT statement but in a different way..If @PageloadYN = 1 SET ROWCOUNT 500ELSE SET ROWCOUNT 0SELECT * FROM Table Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-03-01 : 02:30:18
|
this works too (in 2005)select top(case when @PageloadYN=1 then 500 else 5000000 end) * from mytable elsasoft.org |
 |
|
|
|
|
|