SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Incorrect syntax near 'GO'.
 New Topic  Reply to Topic
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

neeraj_sharma
Starting Member

India
15 Posts

Posted - 06/11/2013 :  05:00:24  Show Profile  Reply with Quote
Use this and let me know



IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ES_TestTable]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[ES_TestTable];

GO

CREATE PROC [dbo].[ES_TestTable]
(
@ErrorCode varchar(512) = Null OUTPUT
)
AS
BEGIN
SET NOCOUNT ON

BEGIN TRY

SELECT [id],
[name]
FROM TestTable

END TRY

BEGIN CATCH
SET @ErrorCode = CHAR(10) + 'Error while retrieving Testtable.'
RETURN
END CATCH

SET NOCOUNT OFF

END





http://www.tutorialsqlserver.com

@nrj
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2210 Posts

Posted - 06/11/2013 :  05:32:56  Show Profile  Reply with Quote
If you have like the below, you will get that error ( GO must be in the next line)
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ES_TestTable]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[ES_TestTable]; go
CREATE PROC [dbo].[ES_TestTable]

You must refer the following link
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=141827

--
Chandu

Edited by - bandi on 06/11/2013 05:34:47
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000