I have a batch statement which I am going to execute via sp_executesql
or Exec
:
Declare @query1 varchar(max), @query2 varchar(max)
Set @query1 = '
select top 10 * from sysobjects;
select top 10 * from sysColumns;'
Set @query2 = '
select top 10 * from sysobjects
select top 10 * from sysColumns
select top 10 * from sysColumns
'
Exec(@query1)
Exec(@query2)
Is there any way by which I can know how many select/insert/update/delete statements or queries are there in a single batch ?
For above Eg; the answer is 2 & 3 respectively
For clarity : I do not decide the batch statements, it directly comes to me via a stored procedure parameter.
I just need to know how many queries is the server executing in this batch.