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
 Update Query Server: Msg 512, Level 16, State 1

Author  Topic 

mgp
Starting Member

9 Posts

Posted - 2009-05-05 : 16:29:42
Hi
I need to update multiple rows in a table.
I'm getting the error message:

Server: Msg 512, Level 16, State 1

The goal is to find all the dates older than what i want and replace them with a later date.

Here is the simple query:

Update tableName
set ColumnName = '2020-01-01 00:00:00.000'
where ColumnName < '2017-01-01 00:00:00.000'

Can anyone help with my sql statement?

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-05-05 : 16:31:56
whats the full error message ?
Go to Top of Page

mgp
Starting Member

9 Posts

Posted - 2009-05-05 : 16:53:00
Full Error message is:
Server: Msg 512, Level 16, State 1, Procedure Update_Activation, Line 6
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-05-05 : 17:01:35
YTou haven't then posted what is driving the error till now. The update sql from the post before looks good. You'll need to post code for Update_Activation.
Go to Top of Page

mgp
Starting Member

9 Posts

Posted - 2009-05-05 : 17:19:32
Fill free to mail me an easy button=P
Thank You Sakets.
There was a trigger on the db named Update_Activation.
I copied it, deleted it and was then sucessful at making the changes=)
Go to Top of Page
   

- Advertisement -