table-variable Questions

8

Solved

In my stored procedure I declared two table variables on top of my procedure. Now I am trying to use that table variable within a dynamic sql statement but I get this error at the time of execution...

2

Solved

If I run the below in MS SQL 2008 R2 I get an unexpected result. create table #DataTable (someID varchar(5)) insert into #DataTable values ('ID1'),('ID2'),('ID3'),('ID4'),('ID5') declare @data v...
Orvie asked 10/9, 2012 at 8:58

2

Solved

Is it possible to have collate SQL_Latin1_General_CP1_CS_AS in table variable columns' definitions? The reason I want to do this is because I have case sensitive information in my source table but...
Emphasis asked 13/8, 2012 at 8:7

2

Solved

Is there anything like table variables in T-SQL? In Sql Server it looks like this: DECLARE @ProductTotals TABLE ( ProductID int, Revenue money ) Then in procedure I can: INSERT INTO @ProductT...
Pathless asked 28/5, 2012 at 13:51

1

Solved

I can't figure out why (or maybe you just can't do this) I get the out of scope error Must declare the scalar variable "@CompanyGroupSites_Master. So is it that I cannot access my Table varia...
Hintz asked 24/5, 2012 at 20:39

1

Solved

what is table variable? And how to create a table variable (virtual in-memory table) with columns that match the existing Stored procedure resultset. I executed the procedure and after executing i...
Gigantes asked 13/3, 2012 at 4:49

3

Solved

This is a section of one of my stored procedure: @dataInTable dbo.Table_Variable readonly, .... AND ( ( @dataInTable IS NULL ) OR ( item IN ( SELECT T FROM @dataInTable ) ) ) @dataInTable IS...
Niehaus asked 5/1, 2012 at 18:17

3

Solved

When I define a "User-Defined Table Type", as: CREATE TYPE [dbo].[BitType] AS TABLE( [B] [bit] NULL ) I place 0 and null in this table-variable. Then I do this query: SELECT something FROM the...
Curcuma asked 5/1, 2012 at 4:54

1

Solved

I have this table variable declaration followed by a query: DECLARE @CurrentItems TABLE ( ItemId uniqueidentifier, ItemUnits int ) UPDATE U SET U.Units = U.Units + [@CurrentItems].ItemUnits FRO...
Trotline asked 16/12, 2011 at 14:9

4

Solved

First, from BOL: Queries that modify table variables do not generate parallel query execution plans. Performance can be affected when very large table variables, or table variables in complex qu...

1

Solved

I've declared a table variable '@t', and have correctly performed the 'INSERT-INTO-SELECT'. When I was trying to query the table variable with some additional computation for per-group row numberin...
Roadside asked 23/11, 2010 at 3:6

3

Solved

Is there a way to define a temp table without defining it's schema up front?
Remember asked 27/3, 2009 at 1:53

4

Solved

We are experiencing performance problems using a table variable in a Stored Procedure. Here is what actually happens : DECLARE @tblTemp TABLE(iId_company INT) INSERT INTO @tblTemp(iId_company) ...

3

Solved

I am trying to update a column inside of a table variable based on a condition, the condition being that the ID of the table variable does not exist in a different table: DECLARE @BugRep TABLE(Bug...
Carapace asked 30/9, 2009 at 16:14

1

Solved

SQL Server 2008: DECLARE @MyTable TABLE( PersonID INT NOT NULL, Person2ID INT NOT NULL, Description NVARCHAR(100), CONSTRAINT PK PRIMARY KEY CLUSTERED (PersonID, Person2ID) ); Gives: Msg 156...

© 2022 - 2024 — McMap. All rights reserved.