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 |
dubaashu
Starting Member
10 Posts |
Posted - 2014-05-11 : 23:48:57
|
Hi All,I want a selection criteria to beselect * from @table Where field = ''If select blank then display complete result and if selected some value then only that value displaythanksAshishAshish gupte |
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2014-05-12 : 01:09:25
|
[code]WHERE Field = CASE @vcVar WHEN '' THEN Field ELSE @vcVar END[/code]sabinWeb MCP |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-05-12 : 07:20:32
|
use a parameter say @param through which you pass the value.make query as belowselect * from @table Where field = @param or @param = '' it will make sure it selects all value when you pass '' to @param------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|