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 |
pssumesh2003
Starting Member
35 Posts |
Posted - 2010-01-21 : 05:14:01
|
Hi every bodyi am working using vs2005 and sql server 2005. In my project i wantto execute a query likeupdate tbltrans set Amount = amount+1000 where id in (100,105,210,225).i want to pass that Ids through my program . i try likedeclare @parametersupdate tbltrans set Amount = amount+1000 where id in @parametersbut get a message cannot convert ---how it possibleplease help me? |
|
Kristen
Test
22859 Posts |
Posted - 2010-01-21 : 05:18:55
|
You can't use a parameter for IN(...)You can use a SPLIT function to convert @parameters into a "table":update Uset Amount = amount+1000 FROM tbltrans AS U JOIN dbo.MySplitFunction(@parameters) AS S on S.SplitID = U.id |
 |
|
Kristen
Test
22859 Posts |
|
pssumesh2003
Starting Member
35 Posts |
Posted - 2010-01-21 : 06:58:13
|
Thank u |
 |
|
|
|
|