|
-
Jun 24th, 2005, 02:57 AM
#1
Thread Starter
Hyperactive Member
TSQL and the RETURN Function **SOLVED**
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:
Code:
CREATE TABLE Log
(
logId integer Identity(1,1) Primary Key Not Null,
created dateTime,
message varchar(50)
)
Go
Then I have a Stored Procedure:
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
When I paste that into my Query Analyzer it says Incorrect syntax near the keyword 'Return'
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
Last edited by Sgt-Peppa; Jun 24th, 2005 at 06:22 AM.
Reason: SOLVED
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Jun 24th, 2005, 05:57 AM
#2
Fanatic Member
Re: TSQL and the RETURN Function
You don't need to use return there:
Code:
CREATE Procedure spCreateLogEntry(@logId integer OUTPUT)
AS
INSERT INTO Log VALUES(GETDATE(),'blah')
SET @logIdId = @@IDENTITY
Go
GRANT EXEC ON spCreateLogEntry TO PUBLIC
Go
Chris
Master Of My Domain
Got A Question? Look Here First
-
Jun 24th, 2005, 06:23 AM
#3
Thread Starter
Hyperactive Member
Re: TSQL and the RETURN Function **SOLVED**
Thanks a lot again! **Hope that was my last TSQL Question**
Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|