.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Difference between Temporary Table and Table Variable in SQL 2005 on Reporting perspective ?

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :Sql Server

Hi friends,

I refered technical difference between Temporary Table and Table Variable.

I would like to know the difference, on SSRS Reports perspective ?

how it would affect performance of report , if we used Temp Table OR Table Variable ?



View Complete Post

More Related Resource Links


help me plis. this thing drive me crazy. it really should be a simple solution but i cant find it, even with googling. i have subreport that display deposit transaction banking statement from account (customer). this subreport will be accessed through main report that loop all accounts in one branch, so its like a batch report processing for all customer in a branch. rendered to pdf and distributed to all our branchs. since i know that subreports header footer wont work on main report, i decide to move the subreport header into subreport table header and make it looks like it was a report header. but THERE is one problem i cant solve, there is ADDRESS BOX that should only VISIBLE on FIRST page for each customer, along with the other header that always visible. how im i supposed to do? please help. been searching n trying for 3 days and cant find any workin solution. been wondering do i really that dumm @_@ . thanks.   ps: sory for my bad english.  

Create table 2000 vs 2005... why the difference?


If I create a table by using a following simple statement:

create table manojtemp (

sn int identity(1,1) primary key not null,

fname varchar(20))

In SQL Server 2000 version I see a table & constraint object created.
But in SQL Server 2005 version I see a table & Index created.

And when I script both of them, I see:

--//  2000
-- Script TABLE
CREATE TABLE [manojtemp] (
[sn] [int] IDENTITY (1, 1) NOT NULL ,
[fname] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,

-- Script Constraint

Can I Feed a table variable or table-like types to my function(My SQL version 2005 Standard SP3)?


Hello All:


My question is whether I can feed a table variable to my table-valued function in SQL 2005 SP3 standard edition?

If no, can I feed a XML type to the function? I guess, probably I can feed a XML. Yet, for this case I am afraid , in the function, the XML-parsing may be costly if I stuff over 10K uniqueIdentifier data into this XML variable.

Any good idea from you ?



--Derek D. 


Temporary tables in SQL Server vs. table variables

When writing T-SQL code, you often need a table in which to store data temporarily when it comes time to execute that code. You have four table options: normal tables, local temporary tables, global temporary tables and table variables. I'll discuss the differences between using temporary tables in SQL Server versus table variables.

sql server 2005 express - don't allow to create table

i have downloaded sql server 2005 Express version from the web and use domainname\SQLEXPRESS as server name but now i can't create table seems every create by sa user, what is the password of this user or how to grand right to my window login user so that i can modify/create something in database.

Which connection owns global temporary table?

Global temporary table exists over time of connection in which was created. I have several connections (sessions) open in management studio. How to check using sql statement, system views, etc... if global temporary table was created in current session?

What is loweredrolename meant in aspnet_users table (SQL Server 2005)

For my existing data, both RoleName and LoweredRoleName are same, but some are lower case and some are in same case too. Anyone knows what is the use of column LoweredRoleName in aspnet_users table?For my existing data, both RoleName and LoweredRoleName are same, but some are lower case and some are in same case too. Anyone knows what is the use of column LoweredRoleName in aspnet_users table?

How to load a new table with the value of a variable from SSIS package?

Hi, i have two variables in a SSIS package Var1 and Var2. Both of these variables have values. is there any way i can put the values of these two variables in a new table? e.g In New table col1 having value of Var1 and col2 having value of Var2. Thanks

How to send record(which is a weblink) from a table to the value of the variable in SSIS package and

Hi Folks, I have table called Table1 with columns, col1 and col2 with col1 having weblinks for the report and col2 the name of the report. Now, i have a package with a variables var1 and var2 which should get the col1 and col2 values respectively from table1 and send it through an email. if the weblink gets updated in the table, package should send the updated link. i know the reverse way of it but trying to do somethig like this. Appreciate any help from you guys. Thanks

Using EXEC with a table variable?

I want to pass the results of a stored proc into a table variable in SQL SEVER 2000. Something like this declare @a table ( employeeid int )   exec @a=dbo.MetricsProcessor_GetTopEmployees @parameter1, @parameter2   ---------------------------------------------------------------------------------------------------------------------------------- I tried insert @a execute dbo.MetricsProcessor_GetTopEmployees @parameter1, @parameter2    but got this error: Msg 197, Level 15, State 1, Line 6 EXECUTE cannot be used as a source when inserting into a table variable.   How can i do this.   Thanks.

T-SQL 2005 table query

Hi, I have SQL 2005 table like below one declare @OrderTable TABLE (OrderID varchar(10),OrderValue decimal(10,2),OrderDate DateTime) INSERT INTO @OrderTable VALUES('P06',25.22,'2010-01-24') INSERT INTO @OrderTable VALUES('P06',25.22,'2010-01-24') INSERT INTO @OrderTable VALUES('P06',25.22,'2010-01-24') INSERT INTO @OrderTable VALUES('P06',25.22,'2010-01-24') INSERT INTO @OrderTable VALUES('P06',25.22,'2010-01-24') INSERT INTO @OrderTable VALUES('P06',455.85,'2010-01-24') INSERT INTO @OrderTable VALUES('P06',866.45,'2010-01-25') INSERT INTO @OrderTable VALUES('P06',749.61,'2010-01-28') INSERT INTO @OrderTable VALUES('P01',755.61,'2010-02-23') INSERT INTO @OrderTable VALUES('P01',755.61,'2010-02-23') INSERT INTO @OrderTable VALUES('P01',755.61,'2010-03-23') Final result I am looking for is SET NULL value in SELECT query Whenever Same OrderID and OrderDate is found... OrderID  OrderValue   OrderDate P06         25.22   2010-01-24 P06        NULL             2010-01-24 P06      NULL             2010-01-24 P06        NULL             2010-01-24 P06      NULL              2010-01-24 P06 &

How to change connection string of a pivot table pointing to SSAS 2005 cube using excel 2003?

Hi All,I am not sure if I should have posted this query to Excel 2003 forum. But posting it here as it applies to SSAS 2005 as well.Ok, let me give the background before I tell the actual problem.We have users on ABC domain and the SSAS server is also on ABC domain. Users on this domain can acess the excel pivots by connecting to cube to browse the data. They leave the Userid & password field blank while they setup the connection string and it works fine. Thanks to windows authentication that takes the credentials of user logged in. Let's say I have two users A and B, they login to ABC domain with their own windows ids.  Now when user A creates a excel file having a cube pivot and then sends this file to user B, user B can refresh and modify the same excel file (he can select new measures to pivot, new hierarchies in filters and so on).Now, let's say I have another user, user C. He has excel 2003 installed on his PC and cannot migrate to excel 2007. He is on different domain XYZ but have a valid windows userid on domain ABC. The domain ABC & XYZ can not be setup to have trusted relationship. Now, when user A sends the same excel file to user C. When user C opens the file and try to refresh it or try to modify the pivot by selecting/deselecting any elements, he gets below error prompt:" An error was encountered in the transport layer." and "Errors in the

check if a table exists in SQL 2005

I'm trying to check if a certain table exists in a given database on a SQL 2005 Server. I've tried numerous times without any result.   can anyone point me in the right direction?

Stored Procedure utilizing table variable

I'm creating a stored procedure that will take the results of a temp table and check for existence using the IN keyword.  The code looks like this: ALTER PROCEDURE [dbo].[studentBranchLogin] -- Add the parameters for the stored procedure here @userName varchar(50), @userPass varchar(20) AS BEGIN DECLARE @dActive bit; DECLARE @TT TABLE (dept int, active bit); -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; INSERT INTO @TT(dept, active) SELECT deptid, active FROM srcuDeptId WHERE active = TRUE -- Insert statements for procedure here SELECT srcuid FROM srcuLogins WHERE logon = @userName AND password = @userPass AND srcuid IN @TT END I get a Msg 170, Level 15 state 1 Line 24: Incorrect syntax near '@TT'. So while I'm sure the @TT temp table isn't being read, I find very few resources for answer what the proper syntax should be.   Any assistance is greatly appreciated.

How to get column value difference of rows in same table

Dear all, I need a TSQL statement to find the difference of values of two rows in the same table, by taking into consideration some conditions. I have the following rowss in a table named table1 dbname  sqlinst     size1   ddate sqldb1    inst1        200    1/1/2009 sqldb1    inst1        250    1/1/2010 sqldb1    inst1        170    1/1/2008 sqldb2    inst2        300    1/1/2009 sqldb2    inst2        340    1/1/2010 I need to find the difference between size1 values, for columns where their dbname and sqlinst are the same. I also need to define in TSQL that the ddate of row from where I subtract (size1) from is 1/1/2010 and that the ddate of the row I subtract (size1) is 1/1/2009 (e.g. in the above example: for sqldb1 inst1, I need to perform 250-200 and ignore 170, and for sqldb2 inst2  340-300). Please let me know if you have a solution for this. A million thanks!

How to declare a table variable in SSIS and then insert rows into it

Hello everyone,   I'll try to explain my problem as clearly as I can: 1)I have an Execute SQL Task that's inside a Foreach Loop Container. 2)Inside the Execute SQL Task, I have an int OUTPUT column. 3)With each iteration, I need to insert the data from the INT output colum into a table variable. 4)After the Foreach Loop finishes the iterations, I need to use the table variable to create a report based on the data inside.   My question is the following: How can I declare a table variable so that I can do all of the above?   Thank you, CostinP

T-SQL 2005 for same table join?

 I have below table with two columns.. Type      Code AB        Company_chris BC        Company_chis DE        Company_chis AB        Company_bob AB         Company_James BC        Company_James AB         Company_mark DE         Coampny_mark BC        Company_scott Unique value in TYPE column : AB , BC, DE Primary Key is :  TYPE and CODE I’m looking output in result query ......... Code                  Type1     Type2     Type3 Company_chris      AB         BC           DE Company_bob      AB         NULL       NULL Company_mark      AB         NULL       DE Company_scott      NULL      BC        NULL   Any t-sql 2005? Thanks.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend