DECLARE @w_type varchar(10), @i varchar(30)
SELECT @w_type='OLTPNORMAL' WHERE @i IN ('0','1','2','3','4','5','9')
The result is:
Thats absolutely okay,
SELECT @i='3' -- assigning value '3' to @i
SELECT @w_type='OLTPNORMAL' WHERE @i IN ('0','1','2','3','4','5','9') -- Assigning @w_type='OLTPMORMAL' if where clause satisfies,here it is satisfying bcoz @i='3'
SELECT @w_type -displaying @w_type
Last edited by rudra; 11-07-06 at 03:06.
Success is the ability to go from one failure to another with no loss of enthusiasm.
- Sir Winston Churchill
Here I have gotten the same result as yours. However, the kind of SQL Synax "SELECT...@local_variable ...WHERE..." is not introduced in SQL SERVER 2005 in Microsoft SQL SERVER 2005 BOOKS ONLINE. So when I found this statement I felt surprised. Can you give me some advice to look for some introductions about the kind of SQL Synax ?