x

Sql Query

The following Proc works in sql 2005/2008 , when we are testing sql server 2012 SSMS gives syntax error . How to fix this one

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[_sample_INSERT]
    @FileServerID uniqueidentifier OUTPUT,
    @upduser varchar(10) OUTPUT,
    @sqlrecid timestamp OUTPUT
AS
DECLARE @ErrorCode int
DECLARE @RowNumber int


INSERT INTO [INTHEMO_CMS].[dbo].[_FileServer] (
    FileServerID,
    upduser,
    insdt,
    upddt)
VALUES (
    @FileServerID,
    @upduser,
    getdate(),
    getdate())

SELECT @sqlRecID = sqlRecID, @ErrorCode = @@ERROR, @RowNumber = @@ROWCOUNT from [INTHEMO_CMS].[dbo].[_FileServer] where FileServerID=@FileServerID


RETURN @@IDENTITY
more ▼

asked Aug 29, 2012 at 01:08 AM in Default

mohan_kk2002 gravatar image

mohan_kk2002
10 1 4 4

Could you supply us with the error message? That normally gives a good indication of what is going wrong.
Aug 29, 2012 at 07:43 AM WilliamD

I don't see why you are creating objects with the underscore character. I'd see that as a risk, regardless of how the script executes.

BTW, I used this script on a test server here and it works without error
Aug 29, 2012 at 08:29 AM Fatherjack ♦♦
Yeah, I just tested it as far as I could and it parses fine. So there's something up. More information needed.
Aug 29, 2012 at 10:44 AM Grant Fritchey ♦♦
(comments are locked)
10|1200 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x985

asked: Aug 29, 2012 at 01:08 AM

Seen: 365 times

Last Updated: Aug 29, 2012 at 10:44 AM