Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HowTo: Release a Table variable
Message
De
13/01/2005 10:24:33
 
 
À
13/01/2005 10:14:23
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00976391
Message ID:
00976779
Vues:
21
Hey, Magnus/Bonnie,

In BOL, if you search on "local variables" and select the 2nd topic (Transact-SQL variables), you'll find the following:

The scope of a variable is the range of Transact-SQL statements that can reference the variable. The scope of a variable lasts from the point it is declared until the end of the batch or stored procedure in which it is declared. For example, this script generates a syntax error because the variable is declared in one batch and referenced in another:
DECLARE MyVariable INT
SET @MyVariable = 1
GO -- This terminates the batch.
-- @MyVariable has gone out of scope and no longer exists.

-- This SELECT statement gets a syntax error because it is
-- no longer legal to reference @MyVariable.
SELECT *
FROM Employees
WHERE EmployeeID = @MyVariable
Was there a specific topic that indicated something different?

Thanks,
Kevin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform