sql server programming:
It seems that sp_executesql call another procedure to execute the batch, so
'select @@nestlevel' is being executed by the second one.
Example:
exec('select @@nestlevel')
execute sp_executesql N'select @@nestlevel'
go
AMB
[quoted text, click to view] "Jean-Nicolas BERGER" wrote:
> Could someone explain me the second answer of this query :
>
> select @@nestlevel
> go
> sp_executesql N'select @@nestlevel'
> go
>
>
> -----------
> 0
>
>
> -----------
> 2
>
>
> I expected 0 and 1 ...
>
> Thx.
> JN.
>
>