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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 comma list in where command

Author  Topic 

raindear
Yak Posting Veteran

64 Posts

Posted - 2014-01-14 : 05:52:21
Trying to run a simple query below

Update CustomerID
set CustomerLevelID='5'
where CustomerID='97000,57700,560046,462334,454453,522444,539743'

When I try this I get

Conversion failed when converting the varchar value

Is it possible to use comma delimited values in a where command?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2014-01-14 : 07:22:16
where CustomerID IN(97000,57700,560046,462334,454453,522444,539743)



Too old to Rock'n'Roll too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-14 : 07:23:40
[code]
Update CustomerID
set CustomerLevelID='5'
where CustomerID IN (97000,57700,560046,462334,454453,522444,539743)
[/code]



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

raindear
Yak Posting Veteran

64 Posts

Posted - 2014-01-14 : 08:36:26
thanks
Go to Top of Page
   

- Advertisement -