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 |
|
corey
Starting Member
13 Posts |
Posted - 2004-11-30 : 15:36:41
|
| Second post today...I don't know what is wrong with me but I am having serious issues.Can someone see what I am doing wrong?DECLARE @new_seq intIF (SELECT image_seq FROM sysadm.picture_it WHERE image_id = 'A000077') isnull BEGIN SET @new_seq = '1' ENDELSE BEGIN SET @new_seq = (SELECT MAX(image_seq) FROM sysadm.picture_it WHERE image_id = 'A000077') SET @new_seq = @new_seq + 1 ENDSELECT @new_seq |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-11-30 : 15:41:38
|
| Are you getting an error?The IF statement should say IS NULL not one word. And the first SET should be SET @new_seq = 1 not the string 1. The second SET is easier if you do this:SELECT @new_seq = MAX(image_seq)FROM ...WHERE ...Tara |
 |
|
|
corey
Starting Member
13 Posts |
Posted - 2004-11-30 : 15:46:17
|
| Once again...I knew I was overlooking something silly. Thanks for the corrections. Much, much, much appreciated! |
 |
|
|
|
|
|