SQL Server creating a tempory table for storing temporary resulsets


BEGIN
IF (OBJECT_ID(‘tempdb.dbo.#temp_table_name_will_be_here)>0)
 TRUNCATE TABLE #temp_table_name_will_be_here
ELSE
CREATE TABLE #temp_table_name_will_be_here
(
      column1 varchar(50),
      column2 int,
      column3varchar(10)
)
END

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s