|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Yesterday @ 11:17 AM
Points: 502,
Visits: 249
|
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 2:21 AM
Points: 14,804,
Visits: 10,597
|
|
Very nice.
Just one small thing. You say that for data storage, temp tables are in TempDB and table variables are in memory and tempDB. I may be misunderstanding what you mean there, but temp tables are also memory resident unless it becomes necessary to write them to disk (memory pressure, too large a table)
Gail Shaw
We walk in the dark places no others will enter We stand on the bridge and none may pass
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Monday, November 16, 2009 8:44 AM
Points: 160,
Visits: 841
|
|
Agree with Gail, nice article, plus I'm reading it that you're suggesting that Data Storage for Temp Table is not in memory - for which it is in-memory unless pushed out to disk.
Also, I'm taking it that, as this article is not an old one, that it covers SQL2005. If this is the case, then INSERT...EXEC is supported for Table Variables. You can test this with the following:
-- SQL2005 DECLARE @helpdb TABLE (name sysname, db_size nvarchar(13), owner sysname, dbid smallint, created nvarchar(11), status nvarchar(600), compatibility_level tinyint) INSERT @helpdb (name, db_size, owner, dbid, created, status, compatibility_level) EXEC dbo.sp_helpdb SELECT * FROM @helpdb
HTH
|
|
|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Today @ 1:10 AM
Points: 663,
Visits: 697
|
|
| Awesome article that covers some of the lesser considered aspects of temporary tables and table variables. Thank you.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, September 24, 2009 3:25 PM
Points: 1,
Visits: 23
|
|
The 2nd chapter about UDTs contains a mistake : the script supposed to raise an error and the workaround don't have any difference. I guess the error script should use a UDT (dbo.Name) instead of a native type (nvarchar(50)).
Thanks to all the authors and SqlserverCentral for their efforts and the useful documentation they bring us.
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 7:26 AM
Points: 18,294,
Visits: 12,311
|
|
Good article!
You did forget to mention one workaround for the UDT's that would allow it to work across all databases including TempDB... Define the UDT in the Master DB. Of course, most folks will argue that the Master DB is a sacred entity that should not be touched and, for the most part, I agree. :D
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Wednesday, November 18, 2009 6:31 PM
Points: 8,401,
Visits: 7,822
|
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Thursday, November 12, 2009 7:14 AM
Points: 3,295,
Visits: 964
|
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 2:21 AM
Points: 14,804,
Visits: 10,597
|
|
rbarryyoung (9/1/2008) Of course we use a startup procedure to define the UDT's in TempDB.
Does defining them in model work as well?
Gail Shaw
We walk in the dark places no others will enter We stand on the bridge and none may pass
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 12:28 AM
Points: 1,369,
Visits: 2,120
|
|
|
|
|