October 3, 2012 at 3:41 am
Hi ,
I am newbie. I would like to what is the difference between SQL queries and Batches. According to MSDN Batches means "A batch is a group of one or more Transact-SQL statements" and to me the same means SQL Queries. In SQL queries we can have more then one T-SQL statement. So what is the difference between the two?
October 3, 2012 at 3:52 am
A query is a single select, insert, update or delete (or related) statements. A batch is a set of one or more statements that are submitted to the server as a single unit.
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 3, 2012 at 4:06 am
Batches are terminated by the GO command.
October 3, 2012 at 6:13 am
laurie-789651 (10/3/2012)
Batches are terminated by the GO command.
Only in a script. The execution of a stored procedure (for example) can be considered to be a "batch" depending on how it's called.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 3, 2012 at 6:33 am
And a script without any GO is a single batch, no matter how long it is.
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
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy