Results 1 to 3 of 3

Thread: TSQL and the RETURN Function **SOLVED**

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476

    Resolved 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width