Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a temp table before a selection is made
Message
 
 
To
24/03/2005 17:00:15
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00999026
Message ID:
00999038
Views:
16
You create a temp table the same way as a regular table, with CREATE TABLE statement. You can also use a table variable wich may be faster.
-- Temp table
CREATE TABLE #temp01 (
	pk int Identity(1,1),
	col1 char(20))
-- Table variabble
DECLARE @table_variable TABLE (
	pk int Identity(1,1),
	col1 char(20))
INSERT INTO @table_variable (col1) VALUES( 'Some text')
SELECT * FROM @table_variable
>The boss wants me to create a temporary table and then do a while loop and feed data into the temporary table row by row.
>
>The only problem I am having is creating a temp table without a select into statement.
>
>How would I create and empty temporary table.
>
>He will not allow the use of a cursor.
>
>I like it here.
>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform