Creating or Altering table syntax

  • Hi,

    I just need to verify if I can combine the two table statement together. I thought I've seen it done

    CREATE OR ALTER TABLE TEMPTEST(

    FIELD1 VARCHAR(10) etc...

    )

    I ran it in Sql Server 2005 and didn't work. Now I'm not sure on this.

    Thanks,

  • [font="Verdana"]such syntax will work with Oracle only. so it won't work in any version with SQL server

    Mahesh[/font]

    MH-09-AM-8694

  • Thanks answers my question

  • [font="Verdana"] instead you can try below method:

    If Exists (Select * From dbo.SysObjects Where id = object_id(N'[dbo].[TempTest]') And OBJECTPROPERTY(id, N'IsTable') = 1)

    Drop Table [dbo].[TempTest]

    Go

    Create Table TempTest (

    Field! VarChar(10),

    ...

    )

    Go

    Mahesh

    [/font]

    MH-09-AM-8694

Viewing 4 posts - 1 through 3 (of 3 total)

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