What is the meaning of line breaks in a SQL Server stored procedure -


stored procedure works

 set ansi_nulls on  go  set quoted_identifier on  go   alter procedure [dbo].[allottectonbay]        @date datetime,       @addtech [dbo].[addtechnicianbayallotment] readonly    begin      set nocount on;       begin try      begin transaction       commit transaction      end try      begin catch          rollback transaction;          declare @errormessage nvarchar(max), @errorseverity int, @errorstate int;           select               @errormessage = error_message() + '' line '' + cast (error_line() nvarchar(5)),               @errorseverity = error_severity(),               @errorstate = error_state();            raiserror (@errormessage, @errorseverity, @errorstate);       end catch  end  go 

but when put on 1 line doesn't work. why? sql server have line end ; in c#?

the problem on go command. must put in single line (and maybe include comments)

a transact-sql statement cannot occupy same line go command. however, line can contain comments.

reference link: mdsn go command

from alter end of stored procedure can put in 1 line.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -