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
 double update

Author  Topic 

JJins
Yak Posting Veteran

81 Posts

Posted - 2010-11-08 : 10:11:15
How can I make this query work....the problem is around the and next to the set comand.

Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'and'.

Update ratedata
set rate = .0002 and Calctype = 'F'
Where coverageid = 11 and pcmax = 8 and limitmax = 1000
and programid IN
(1823, 1826, 1829, 1832, 1835, 1838, 1841, 1844, 1847, 1850, 1853, 1856, 1859, 1862, 1865, 1868, 1871, 1874, 1877, 1880, 1883, 1886, 1889, 1892, 1895, 1898, 1901, 1904, 1907, 1910)



Thanks for the help.


Best,
Graham

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-08 : 10:13:08
replace AND by , (comma)


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

JJins
Yak Posting Veteran

81 Posts

Posted - 2010-11-08 : 10:18:11
Update ratedata
set rate = .0002 by Calctype = 'F'
Where coverageid = 11 and pcmax = 8 and limitmax = 1000
and programid IN
(1823, 1826, 1829, 1832, 1835, 1838, 1841, 1844, 1847, 1850, 1853, 1856, 1859, 1862, 1865, 1868, 1871, 1874, 1877, 1880, 1883, 1886, 1889, 1892, 1895, 1898, 1901, 1904, 1907, 1910)

will this change both the rate and calctype?

thanks for the help.

Best,
GG
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-08 : 10:26:23
quote:
Originally posted by JJins

Update ratedata
set rate = .0002 by , Calctype = 'F'
Where coverageid = 11 and pcmax = 8 and limitmax = 1000
and programid IN
(1823, 1826, 1829, 1832, 1835, 1838, 1841, 1844, 1847, 1850, 1853, 1856, 1859, 1862, 1865, 1868, 1871, 1874, 1877, 1880, 1883, 1886, 1889, 1892, 1895, 1898, 1901, 1904, 1907, 1910)

will this change both the rate and calctype?

thanks for the help.

Best,
GG


You have misunderstood - see above
You can update many columns in one update statement when separating them by comma.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -