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
 Incorrect syntax near where

Author  Topic 

rowter
Yak Posting Veteran

76 Posts

Posted - 2009-11-11 : 12:04:21
Hi,

Can anyone tell me what is wrong with this query?
I keep getting the Incorrect syntax near Where" error.


Update Regulars SET LockedBy = , Updt_Rec_UserID = ASHWINI, Updt_Rec_Dt_Time = 11/10/2009 7:13:32 PM,State_ID = (Select State_id from state_lkup where State_nm = 'GEORGIA') Where Regulars_ID = 'WFYAPIZZ'

Thanks in advance

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-11 : 12:08:43
[code]Update Regulars
SET LockedBy =<value here> ,
Updt_Rec_UserID = 'ASHWINI',
Updt_Rec_Dt_Time = '11/10/2009 7:13:32 PM',
State_ID = (Select State_id from state_lkup where State_nm = 'GEORGIA')
Where Regulars_ID = 'WFYAPIZZ'[/code]
Go to Top of Page

rowter
Yak Posting Veteran

76 Posts

Posted - 2009-11-11 : 12:26:28
Thanks

I am getting the value in lockedby and
Now, i get the following error:
Incorrect syntax near '7'. Incorrect syntax near the keyword 'Where'.


What is wrong with this?

Update Regulars SET LockedBy = Null,Updt_Rec_UserID = ASHWINI, Updt_Rec_Dt_Time = 11/10/2009 7:33:50 PM,State_ID = (Select State_id from state_lkup where State_nm = 'GEORGIA') Where Regulars_ID = 'IERITLSI'

Thanks in Advance
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-11 : 12:28:31
quote:
Originally posted by rowter

Thanks

I am getting the value in lockedby and
Now, i get the following error:
Incorrect syntax near '7'. Incorrect syntax near the keyword 'Where'.


What is wrong with this?

Update Regulars SET LockedBy = Null,Updt_Rec_UserID = ASHWINI, Updt_Rec_Dt_Time = 11/10/2009 7:33:50 PM,State_ID = (Select State_id from state_lkup where State_nm = 'GEORGIA') Where Regulars_ID = 'IERITLSI'

Thanks in Advance


did you notice what i posted? watch the '' across string values
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-11 : 12:34:49
And of course in this case the date is also a string...


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

rowter
Yak Posting Veteran

76 Posts

Posted - 2009-11-11 : 13:45:40
Thanks,

My mistake didn't see it. Working now.
Go to Top of Page
   

- Advertisement -