Groups | Blog | Home
all groups > sql server msde > march 2006 >

sql server msde : MSDE (SQL Server 2000) does not return @@Identity


Anbu
3/28/2006 9:03:54 PM
Hi All,

First my apologize for cross posting. It's already posted in
sqlserver.programming. But I see this group would also help me.

I'm creating an appplication with some stored procedures. The stored
procedure needs to return the @@Identity of the table's new record. The

function has no errors and compiles without any warnings. The function
does work fine some times (returning value). But most of the calls are
failing and the function does not return proper value.


CREATE PROCEDURE CreateNewCourse
@CourseName NVARCHAR(256),
@Duration Int,
@Contents NVarChar(500),


AS


DECLARE @Identity int


INSERT into CourseMaster
(
CourseName,Contents,
Duration


)
VALUES
(
@CourseName,
@Contents,
@Duration
)


SET @Identity = SCOPE_IDENTITY()


return @Identity


Any suggestions???


TIA.
Roger Wolter[MSFT]
3/28/2006 10:44:54 PM
Return identity as an output parameter.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

[quoted text, click to view]

AddThis Social Bookmark Button