Temporary Tables

1. Temporary Tables are similar to tables unlike they are life is only for the current session and it will be automatically dropped after that.
2. This is very useful for storing some information during a large computations temporarily instead of using physical tables.
3. They cannot have foreign key constraints.
4. It is stored in the TempDB.
5. The Syntax is
CREATE TABLE #< TableName >(< ColumnName1 > < Datatype >,< ColumnName2 > < Datatype >…)
6. The below shows an example how to create a temporary table
CREATE TABLE #tempEmployees(EmployeeID int PRIMARY KEY,
FirstName varchar(50),
LastName varchar(50),
Sex char(1),
Age int CONSTRAINT df DEFAULT 18,
DateOfBirth DateTime)

Comments

Popular posts from this blog

Jesus - God Thinks of you.

ASP.NET 4.0 Feature - URL Routing

Tips on JQuery Intellisense in VS 2008