When and how does SQL Server use variables from memory in stored procedures?

When we create a stored procedure, we can create some variable as follows:

DECLARE @UserCount INT

We use this variable in the stored procedure. But we do not have this variable at the end of the stored procedure. We have cursors with DEALLOCATE, but we do not write ant strings for the variables that we create.

Another confusion - we create tables and call them "@table"

When and how does Sql Server have such variables?

+4
source share
3 answers

In MSDN:

" - Transact-SQL, . , ."

http://msdn.microsoft.com/en-us/library/ms187953.aspx

- (#MyTable) (@MyTable). sproc , temp, , .

+3

,

We dispose Cursors with DEALLOCATE but we don't write ant lines for variables

MSDN :

. ,

, , SQL Server 2000

+1

@Bob Palmer, . . , , , . .

. : MSDN

0

Source: https://habr.com/ru/post/1772232/


All Articles