SP using $identity fails

Apr 13, 2010 at 10:38 PM
Edited Apr 13, 2010 at 10:49 PM

Trying your tool, one thing came up:

Error #: 40517 -- Keyword or statement option '$identity' is not supported in this version of SQL

Should perhaps come up in the analyze stage?

Anyway, thanks, you saved me a lot of time.

Kind regards,

Inge Henriksen.

 

CREATE PROCEDURE spStoreMessage

    @clientAddress nvarchar(255) = NULL,
    @pageUrl nvarchar(400) = NULL,
    @userName nvarchar(50) = NULL,
    @message nvarchar(255) = NULL
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Get the client address id
    DECLARE @clientId INT
    SET @clientId = (SELECT id FROM tblClient WHERE address LIKE @clientAddress)
    IF @clientId IS NULL
    BEGIN
        INSERT tblClient(address) VALUES (@clientAddress)
        SET @clientId = (SELECT MAX($IDENTITY) FROM tblClient)
    END
...

Coordinator
Apr 14, 2010 at 5:04 PM
Edited Apr 14, 2010 at 5:04 PM

Thanks Inge!

I will put that in my NotSupportedByAzureFile.config.  If you want, you can add the following line to your NotSupportedByAzureFile.config (under <GeneralTSQL>):

<NotSupported Text="\$IDENTITY" ReplaceWith="" SeverityLevel="2" ReplaceString="false" DisplayWarning="true" DefaultMessage="true" WarningMessage="" />

 

This should catch the IDENTITY issue until I make a new release.

Thanks again,
George

Apr 14, 2010 at 5:43 PM

Ok, fine by me.

-Inge