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 |
|
madscientist
Starting Member
30 Posts |
Posted - 2007-11-29 : 18:48:08
|
| Hello everyone. I am new to this forum and hoping to get some help. I am running a new job that is using T-SQL stored procedure but am getting the error:Incorrect syntax near '01_ADD_COLUMNS_NOT_EXIST'. [SQLSTATE 42000] (Error 102). The step failed.I am relatively new to MS SQL Server 2005 and this is the first time I have programmed a job. In the Command field I typed:EXEC "01_ADD_COLUMNS_NOT_EXIST" which calls the stored procedure.When I execute the stored procedure it works fine but in a job it fails and gives me the error.Here is the syntax for the stored procedure:set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgoALTER PROCEDURE [dbo].[01_ADD_COLUMNS_NOT_EXIST]ASIF NOT EXISTS (SELECT * FROM syscolumnsWHERE id = object_id('COVERAGE') AND name = 'COVERAGE_ANNUAL_PREMIUM')ALTER TABLE COVERAGE ADD COVERAGE_ANNUAL_PREMIUM FLOAT NULLAm I missing something somewhere? Thank you very much in advance. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-11-29 : 19:06:25
|
| In the job, you shouldn't have double quotes around the stored procedure name. Just EXEC SprocName.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
madscientist
Starting Member
30 Posts |
Posted - 2007-11-30 : 16:34:40
|
| Thank you very much Tara.Another issue I noticed when I removed the double quotes is that the stored procedure cannot begin with a #. It still wasn't working until I changed the stored procedure to ADD_COLUMNS_NOT_EXIST. Now it works so thank you again. |
 |
|
|
|
|
|