SQL:Casting a String to IDS with IN clause
Posted
by Shyju
on Stack Overflow
See other posts from Stack Overflow
or by Shyju
Published on 2010-05-05T13:23:00Z
Indexed on
2010/05/05
13:28 UTC
Read the original article
Hit count: 224
DECLARE @STR_IDS VARCHAR(15)
SET @STR_IDS='7,15,18'
UPDATE TBL_USERS WHERE ID IN @STR_IDS
I know the update statement would not work as the ID is of type INT and i am replacing a varachar value there .How can i change the query so that it will be executed like this in effect ?
UPDATE TBL_USERS WHERE ID IN (7,15,18)
Thanks in advace
© Stack Overflow or respective owner