Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a temp table before a selection is made
Message
 
 
À
24/03/2005 17:00:15
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00999026
Message ID:
00999038
Vues:
18
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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform