Looking a function to declare a table variable

  • I need to declare a table variable from another existing table.

    If I use "Script table as" will create table variable with [], like

    CREATE TABLE [dbo].[CLAIM](

    [CLAIMNO] [varchar](20) NOT NULL,

    [ACCT] [varchar](4) NOT NULL,

    ....

    Is there a function can return script without [ ]?

  • Why are you concerned about the [] this works:

    DECLARE @CLAIM table(

    [CLAIMNO] [varchar](20) NOT NULL,

    [ACCT] [varchar](4) NOT NULL)

    INSERT INTO @CLAIM

    SELECT 1, 'Did' UNION ALL

    SELECT 2, 'Doit'

    SELECT * FROM @CLAIM

    /* Results:

    CLAIMNOACCT

    1Did

    2Doit

    */

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply