Showing posts with label testdon. Show all posts
Showing posts with label testdon. Show all posts

Thursday, February 16, 2012

"Go" into comments

Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, =C9tat 1, Proc=E9dure testdon, Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, =C9tat 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
DonaldThe problem is that your GO is *not* inside the comments. The client tool (Query Analyzer, OSQL or
what you are using) will see the GO and separate the batches. So, the first batch doesn't have an
end-comment. And the next batch doesn't have a start-comment.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, État 1, Procédure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, État 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald|||Correct, the GO is between the comment block...but as you have noticed it is
not treated properly. This works:
alter PROC testdon
AS
-- drop table setup
-- go
SELECT *
FROM MRP_SM_BALPL
It is easy to "multi comment" lines within SQL 2000 Query Analyzer. Simply
highlight the lines and hit Ctrl-Shift-C. Ctrl-Shift-R removes comments.
--
Keith
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, État 1, Procédure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, État 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald|||Because GO is a batch separator and is parsed PRIOR to the comment
delimiters. Try highlighting the code you want to comment and hitting
CTRL+SHIFT+C -- comment
CTRL+SHIFT+R -- remove comment
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, État 1, Procédure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, État 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald|||Hi Mister Aaron,
Thanks for the explanations,
But : those operation do not work with Query analyser version 7.00.623 :o(
CTRL+SHIFT+C -- comment
CTRL+SHIFT+R -- remove comment
Donald
>--Original Message--
>Because GO is a batch separator and is parsed PRIOR to the comment
>delimiters. Try highlighting the code you want to comment and hitting
>CTRL+SHIFT+C -- comment
>CTRL+SHIFT+R -- remove comment
>-- >http://www.aspfaq.com/
>(Reverse address to reply.)
>
>
>"Donald" <anonymous@.discussions.microsoft.com> wrote in message
>news:818101c495b5$833dc860$a601280a@.phx.gbl...
>Hi every one,
>Using SQL 7.0,
>Why do i get the following error when i run this :
>
>alter PROC testdon
>AS
>/*
>drop table setup
>go
>*/
>SELECT *
>FROM MRP_SM_BALPL
>error :
>Serveur : Msg 113, Niveau 15, =C9tat 1, Proc=E9dure testdon,
>Ligne 6
>Missing end comment mark '*/'.
>Serveur: Msg 170, Niveau 15, =C9tat 1, Ligne 1
>Line 1: Incorrect syntax near '*'.
>If i remove "Go", it works... :o\
>But it's into comments !
>Thanks !
>Donald
>
>.
>|||Also, Go is not a T-SQL keyword. It's just a batch separator that tools
like Query Analyzer understand. ie. you would never use "go" inside a
stored procedure.
--
David G.