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 |
|
interclubs
Yak Posting Veteran
63 Posts |
Posted - 2003-01-05 : 21:50:37
|
| The following stored procedure keeps giving me errors, telling me that I can't use a column name in the statement...I know it should be simple, anyone have any ideas? I am just trying to update the column 'clicked' by one every time the stored proc. runs and return the 'LinkURL'.CREATE PROCEDURE LM_Clicked@MessageID intASDeclare @ID intBEGIN TRANInsert Into LM_Links(Clicked, LastClick)Values(Clicked+1, GetDate) where MessageID=@MessageIDSelect @ID=@@IDENTITYSelect LinkURL from LM_Links where ID = @IDIF @@ERROR>0Rollback TranCOMMIT TRANRETURNThanks Guys! |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-01-05 : 22:25:46
|
I think you want to UPDATE, instead of INSERT ???quote: I am just trying to update the column 'clicked' by one every time the stored proc. runs and return the 'LinkURL'.
If not, maybeInsert Into LM_Links(Clicked, LastClick) SELECT Clicked+1, GetDate()FROM LM_LinksWHERE MessageID=@MessageID Select @ID=@@IDENTITY Select LinkURL from LM_Links where ID = @ID - Jeff |
 |
|
|
interclubs
Yak Posting Veteran
63 Posts |
Posted - 2003-01-05 : 23:01:06
|
| Been a long weekend! Yeah, it was supposed to be an update, which was the prob. Thanks! |
 |
|
|
|
|
|