Wednesday, January 19, 2011

Tempory Tables in SQL

Temporary Table is a very useful tool when using SQL Server, and you are only needing a table for this one session of SQL.  After creating the table and filling with the with temporary data you only need for one session, you can use it like any other normal table, but it will be automatically dropped after closing that session of SQL.  The only restraint on this is that you cannot use foreign keys with Temp Tables.

Syntax to Create Temp Table:
create database BLOG
create table #Yaks (
       YakID int
       ,YakName char (30) )

//Special Note to the pound sign(#) infront of table name Yaks

No comments:

Post a Comment