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
 why isn't this proc working?

Author  Topic 

d4046949
Starting Member

9 Posts

Posted - 2008-08-20 : 14:21:00
hey guys, i've written this:


insert into table1(date) values (@date) where (id=@id);

but I'm getting this error:
quote:

Incorrect syntax near the keyword 'where'.


can't seem to solve it. :(

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-20 : 14:31:31
You can't use a where clause when using values.

Are you just trying to update an existing row? If so, use update instead of insert:

UPDATE table1
SET date = @date
WHERE id = @id

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -