Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
roger_james_jr
Starting Member
7 Posts |
Posted - 2004-09-30 : 21:23:07
|
| Hi,Can someone please help me with this. I am not sure why it is failing, or how to fix it.Server: Msg 156, Level 15, State 1, Line 6Incorrect syntax near the keyword 'PROCEDURE'.Server: Msg 137, Level 15, State 1, Line 14Must declare the variable '@mySomething'.BEGIN TRANSACTION myTransactionIF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[mytable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)BEGINALTER PROCEDURE myProcedure( @myID INT, @mySomething VARCHAR(255))ASSELECT @mySomething + myFieldValue AS myDesiredResultFROM myTableENDCOMMIT TRANSACTION myTransaction |
|
|
dev45
Yak Posting Veteran
54 Posts |
Posted - 2004-10-01 : 02:11:41
|
| the following should workBEGIN TRANSACTION myTransactionIF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[table1]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GOALTER PROCEDURE myProcedure@myID INT,@mySomething VARCHAR(255)ASSELECT@mySomething + b AS myDesiredResultFROMtable1GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GOCOMMIT TRANSACTION myTransactionbut why r u cheking on the existence of the table in order to alter a procedure ? shouldn;t u check the existence of the procedure ? ;) |
 |
|
|
|
|
|