faqts : Computers : Programming : Languages : Asp : ASP/VBScript : Database Backed Sites

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

522 of 543 people (96%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

How can I create Dynamic Tables in SQL SERVER 7.0?

Jul 22nd, 2000 00:36
unknown unknown, Bruce Anwyl


To create a temporary table you must put a # symbol as the first 
character in the table name. If the table is created in a stored 
procedure then it is automatically dropped when the stored procedure 
returns.
        CREATE TABLE #InvoiceData
        (
                [JobID] [int] NOT NULL ,
                [ItemUnit] [varchar] (3) NOT NULL ,
                [ItemName] [varchar] (50) NOT NULL ,
                [ItemUnitPrice] [money] NOT NULL
        )
To use the temporary table, you refer to it using the name as follows
        INSERT INTO #InvoiceData
                . . . extra stuff here.
If you want a permanent table then use the same syntax without the #.



© 1999-2004 Synop Pty Ltd