About Me

My photo
Mumbai, Maharastra, India
He has more than 7.6 years of experience in the software development. He has spent most of the times in web/desktop application development. He has sound knowledge in various database concepts. You can reach him at viki.keshari@gmail.com https://www.linkedin.com/in/vikrammahapatra/ https://twitter.com/VikramMahapatra http://www.facebook.com/viki.keshari

Search This Blog

Tuesday, March 26, 2013

GO, you can also specify your own word as a batch terminator


GO is a batch terminator, you can however change it to whatever you want.

Also read previous articles on GO

Go to Tool-> Option -> Query Execution













And then change the Batch Separator to word of your choice, here in this example, I changed it to BATCH.

Now if I try to write code with batch separators GO, SSMS will not recognize.

alter table tab2
add  d_manager varchar(10)
GO
select d_id,d_name,d_manager from tab2

Msg 102, Level 15, State 1, Line 4
Incorrect syntax near 'GO'.

Now if we replace GO with BATCH, it should work properly. Lets see

alter table tab2
add  d_manager varchar(10)
BATCH
select d_id,d_name,d_manager from tab2 

So this is how you can specify your own word as a batch terminator

Your code, sound the horn 


Post Reference: Vikram Aristocratic Elfin Share

No comments:

Post a Comment