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 |
|
azamsharp
Posting Yak Master
201 Posts |
Posted - 2005-12-29 : 17:26:03
|
| CREATE PROCEDURE [sp_InsertHtmlContent] @uploadLog_ID int, @contFormatLU_ID int, @contentSubPath nvarchar(200), @contentFileName nvarchar(200), @psFormatType_ID int, @timesUsed int, @contentBlob image, @byteCount int, @ctds datetime,@m4Delete bitAS-- Id to be returned DECLARE @returnValue int BEGIN TRAN INSERT INTO tblContentContentImport(tblUploadLog_ID, tblContFormatLU_ID, ContentSubPath, ContentFileName, PSFormatType_ID, TimesUsed, ContentBlob, ByteCount, CTDS, M4Delete) VALUES(@uploadLog_ID, @contFormatLU_ID, @contentSubPath, @contentFileName, @psFormatType_ID, @timesUsed, @contentBlob, @byteCount, @ctds, @m4Delete) -- If there is no error then commit the transcation IF @@ERROR = 0 BEGIN COMMIT TRAN RETURN SCOPE_IDENTITY()END ELSE BEGIN ROLLBACK TRANRETURN -1ENDGOMohammad Azam www.azamsharp.net |
|
|
cshah1
Constraint Violating Yak Guru
347 Posts |
Posted - 2005-12-29 : 17:36:44
|
| Where are you setting this variable in your code...? Instead of RETURN SCOPE_IDENTITY() use output variable if you want to return the latest identity value. -- Id to be returned DECLARE @returnValue int |
 |
|
|
azamsharp
Posting Yak Master
201 Posts |
Posted - 2005-12-29 : 19:16:08
|
| Ohh, yeah you are right. Apart from that do is the SPROC okay? I forgot to delete the variable @returnValue since I don't need it.Mohammad Azam www.azamsharp.net |
 |
|
|
|
|
|
|
|