SA0268 : Table variable is not used as table source
The topic describes the SA0268 analysis rule.
Table variable is not used as table source
The rule checks T-SQL code for table variables declared, but not used as a table source in any FROM clause of following SELECT, UPDATE, DELETE or MERGE statements.
Review the code and the table variable usages and remove it if is not really needed.
The rule has a Batch scope and is applied only on the SQL script.
Rule has no parameters.
The rule does not need Analysis Context or SQL Connection.
Design Rules, Bugs
There is no additional info for this rule.
1DECLARE @Greeting TABLE 2( 3GreetingId INT IDENTITY (1,1) PRIMARY KEY, 4Message nvarchar(255) NOT NULL 5); 6 7SELECT * INTO #Greeting2 FROM dbo.Greeting 8 9INSERT INTO @Greeting (Message) 10SELECT 'Hello!' 11UNION ALL 12SELECT 'Hi!' 13UNION ALL 14SELECT 'Hello, world!' 15 16DELETE @Greeting WHERE GreetingId = 3 17 18-- SELECT * FROM @Greeting g WHERE g.Message like 'Hello%'
|1||SA0268 : Table variable is not used as table source.||1||8|