Hi all,
me again, still working on my Database script. I have a Problem using the Return Function of TSQL. I am using MS SQL Server 2000.
Heres my Table that I create:
Then I have a Stored Procedure:Code:CREATE TABLE Log ( logId integer Identity(1,1) Primary Key Not Null, created dateTime, message varchar(50) ) Go
When I paste that into my Query Analyzer it says Incorrect syntax near the keyword 'Return'Code:CREATE Procedure spCreateLogEntry(@logId integer OUTPUT) AS INSERT INTO Log VALUES(GETDATE(),'blah') SET @logIdId = RETURN(@@IDENTITY) Go GRANT EXEC ON spCreateLogEntry TO PUBLIC Go
The RETURN Function is supposed to return the created logId, since this is an autoincrement field in my Table. I need that value as return value of my Stored Procedure. Any ideas on how I can get this to work?
Thanks for your help,
Stephan





Reply With Quote