October 25, 2010 at 11:17 am
DELETE FROM emp
WHERE job = 'clerk';
go
i m getting som erros.i read alomst 10 to 15 of articles on go command still i m not able to get it.i m trying all the possible stuffs with it.but all the time i get some error.
help me out pls
thanks in advance
jay thakkar,student,india
October 25, 2010 at 12:13 pm
It's simply a batch delimiter. It tells the client tool where to break apart batches to send to SQL. It is not actually a SQL command.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 25, 2010 at 12:15 pm
What are the error messages you get? The query itself looks fine...
There can be anything like permission issues, mis-spelled table or column name, data type conflict, foreign key references - just to name a few.
October 25, 2010 at 12:17 pm
i kno "go" isnt a part of t-sql.
but the statement i wrote shld get executed.
it isnt.why??
if i remove "go" it works fine
why???
October 25, 2010 at 12:19 pm
go only works in ssms is that true??
if i execute the same query in query editor of ssms it works fine.
October 25, 2010 at 12:24 pm
you have to use either ";" or "GO"
but not both of them.
both are batch separator
October 25, 2010 at 12:28 pm
; --> statement delemeter or terminator
GO --> batch terminator.
i read somewhere.
October 25, 2010 at 12:37 pm
sanjays-735734 (10/25/2010)
you have to use either ";" or "GO"but not both of them.
both are batch separator
That is not true.
The ; is a statement delimiter. It shows where the end of the statement is. GO breaks apart batches.
Easy to demonstrate. The first example works, the second does not.
DECLARE @i int;
SET @i = 1;
SELECT @i;
DECLARE @i int
GO
SET @i = 1
GO
SELECT @i
GO
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 25, 2010 at 12:38 pm
jay.supersaiyan (10/25/2010)
i kno "go" isnt a part of t-sql.but the statement i wrote shld get executed.
it isnt.why??
if i remove "go" it works fine
why???
No idea. It looks fine.
What's the error you're getting? Is that the entire script?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
October 25, 2010 at 12:41 pm
now its working fine i guess.i read some where that go command will only work in query editor of ssms.
so statements
use employeedb;
go
select * from emp;
go
are working fine till now.
jay thakkar,student,india
October 25, 2010 at 12:54 pm
You still haven't provided any of the error messages you mentioned. Please post those errors.
October 26, 2010 at 8:11 am
it was "incorrect syntex error near go".now its working fine..
i was using a query editor on which go dosnt work.
October 26, 2010 at 10:09 am
Which editor? As an FYI for me.
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply