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 |
saidev
Posting Yak Master
101 Posts |
Posted - 2006-07-11 : 15:51:14
|
I have a table called EMP, Here is the FieldsID TempID1 02 0 3 04 05 06 1 7 28 39 410 5If ID = TempID i,e 1 = 1 then i should not allow the user to update this table. how can we check this condition in Sql Query. can you guys help me with the query.Thanks |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-07-11 : 17:05:56
|
I assume you'll already know what user you are after, so:IF EXISTS (SELECT * FROM EMP WHERE ID = @YourIDvariable AND TempID = @YourIDvariable) -- allow updateTara Kizeraka tduggan |
 |
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2006-07-12 : 00:01:25
|
orupdate tablenameset ....where id<>tempID and id=@id--------------------keeping it simple... |
 |
|
|
|
|