use DB Create Table Frogs ( ID int primary key identity(1,1) ,Legs int not null ,Color varchar(8982) ) * look up temp tables and table variable --syntax --when to use 4 ways to store data: local temporary tables (#table_name), global temporary tables (##table_name), permanent tables (table_name), and table variables (@table_name). Local Temporary Tables Create Table #pimp ( id int ,daddy varchar(50) ) A temporary table is created and populated on disk, in the system database tempdb — with a session-specific identifier packed onto the name, to differentiate between similarly-named #temp tables created from other sessions. The data in this #temp table (in fact, the table itself) is visible only to the current scope (usually a stored procedure, or a set of nested stored procedures). The table gets cleared up automatically when the current procedure goes out of scope, but you should manually clean up the data when you're done with it. Table Variables Declare @people table ( id int ,name varchar(32) ) A table variable is created in memory, and so performs slightly better than #temp tables (also because there is even less locking and logging in a table variable). A table variable might still perform I/O to tempdb (which is where the performance issues of #temp tables make themselves apparent), though the documentation is not very explicit about this. I found all of my information here.
Wednesday, January 19, 2011
Advanced Relational Database /* Temp Tables and Table Variables */ 1/19/11
Subscribe to:
Post Comments (Atom)
Classes
Programming II
Advanced Relational Database
Blog Archive
-
▼
2011
(35)
-
▼
January
(19)
- Challenge me in Mini Putt!
- Advanced Relational Database /* Inner Join between...
- Programming 2 /* Case Statements */
- Programming 2 /* If Statements */
- How to draw a Cartoon Banana.
- Programming 2 /* Practice #1 - Acts and Facts */
- Programming 2 /* how to join a string to another s...
- Programming 2 /* how to convert an integer into a ...
- Advanced Relational Database /* Assignment 1 Frog ...
- Creating A Database in Microsoft SQL Server 1/24/11
- Converting a number variable into a string 1/24/11
- Variables in Visual Basic 1/24/11
- Advanced Relational Database /* Testing the creati...
- Advanced Relational Database /* Testing the creati...
- Advanced Relational Database /* Testing the creati...
- Advanced Relational Database /* Temp Tables and Ta...
- Programming 2 /* Repeatable Processing */ 1/19/11
- M&M
- Code
-
▼
January
(19)
No comments:
Post a Comment