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 |
|
osirisa
Constraint Violating Yak Guru
289 Posts |
Posted - 2008-10-15 : 11:59:16
|
Hi,I created a table "Authorization" that contains a column "STATUS". I am using this Table to run an application that enter new Status. However, I want to check if is already DATA in the STATUS column. If is data in the Status Column I don't want to update this field. This is what I have done so far.....Thanks for the help  ELSE IF @SQLType= 'Check' BEGIN -- Pull records from the Authorization table -- Used to check if there is a matching record SELECT STATUS FROM Authorization WHERE Unique_Identifier = @UI END Thank you for all your help..... |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-15 : 12:05:53
|
[code]ELSE IF @SQLType= 'Check' AND EXISTS (SELECT * FROM Authorization WHERE Unique_Identifier = @UI) BEGIN -- Pull records from the Authorization table -- Used to check if there is a matching record END[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
osirisa
Constraint Violating Yak Guru
289 Posts |
Posted - 2008-10-15 : 12:25:35
|
| Thanks Peso,I am getting some kind of syntax Error. If I understand correctly ELSE IF @SQLType= 'Check' BEGIN EXISTS (SELECT * FROM Authorization WHERE Unique_Identifier = @UI) ENDI Think in this case we are checking if the record exist. If the full record exist. I already know that the record exist. I need to know if is data inside the "STATUS COLUMN" and if is data inside I don't need to do anything else. Thanks for the help. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-15 : 12:39:35
|
quote: Originally posted by osirisa Thanks Peso,I am getting some kind of syntax Error. If I understand correctly ELSE IF @SQLType= 'Check' BEGIN EXISTS (SELECT * FROM Authorization WHERE Unique_Identifier = @UI) ENDI Think in this case we are checking if the record exist. If the full record exist. I already know that the record exist. I need to know if is data inside the "STATUS COLUMN" and if is data inside I don't need to do anything else. Thanks for the help.
cant use EXISTS() inside BEGIN END.. Use it with IF as given by Peso |
 |
|
|
|
|
|