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.
Author |
Topic |
sapator
Constraint Violating Yak Guru
462 Posts |
Posted - 2007-11-29 : 05:17:22
|
Hi.I have this procedure. So what i want to do is update ONLY the rows that has this specific number. Now when i run it, if it finds the number in the column, it updates ALL the rows to null and no the ones that only have the specific number.thanks.declare @mainid intselect @mainid = 6Update tbltriggerfriend set tbltriggerfriend.DNSid= NULLwhere exists (SELECT tbltriggerfriend.DNSidFROM dbo.tbltriggerfriendwhere DNSid=@mainid ) |
|
kishore_pen
Starting Member
49 Posts |
Posted - 2007-11-29 : 05:31:17
|
you can give another where clause in your update statement. |
 |
|
sapator
Constraint Violating Yak Guru
462 Posts |
Posted - 2007-11-29 : 05:45:30
|
No it's ok.It just needs where DNSid=@mainid |
 |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2007-11-29 : 05:48:38
|
No, all you need is:declare @mainid intselect @mainid = 6Update tbltriggerfriend set tbltriggerfriend.DNSid= NULLwhere DNSid=@mainid |
 |
|
sapator
Constraint Violating Yak Guru
462 Posts |
Posted - 2007-11-29 : 08:41:23
|
Yes found it.Thank RickD |
 |
|
|
|
|