Conditional Conditons in SQL Server -


i have combobox 3 values: all, failed, completed.

all: load rows , no condition. failed , completed: load condition on column 'status'.

all:

select * tbl_location 

failed , completed:

select * tbl_location status = 'failed' 

or

select * tbl_location status = 'completed' 

i have 2 statues 'failed' , 'completed'. 'all' combo-box value load rows without condition

i want in 1 query. can do?

declare @status varchar(15)  --set status  select *  tbl_location status = @status or @status = 'all' 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -