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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Update query problem

Author  Topic 

rupalim
Starting Member

20 Posts

Posted - 2011-06-02 : 14:14:10
Hi ,
I have a little doubt in update statemnt .

if we have to update a record which has 2 unique columns hw can we do that ??
suppose i have 1 identity column which is primary ,
and when i m trying to insert a value for the other 2 columns the same value which exists in the table ,then unique key error is fired .

in this how can i write the update query???


plz provide me the solution

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-06-02 : 14:35:53
You can't insert in this case, but UPDATE
UPDATE yourTable
SET col1 = x
,col2 = y
where primaryColumn = z

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
   

- Advertisement -