Search code examples
sybasesap-ase

Adding several coloumns in one alter


ALTER TABLE 'S_DET' ADD(
'SCHETION' VARCHAR(1) ,
'FDATE'     DATETIME    ,
'TDATE' DATETIME    ,
'SCTIME'    VARCHAR(8)  ,
'SCTYPE'            VARCHAR(10),
'PERY'              VARCHAR(10),
'P_NB'  NUMERIC(2)  ,
'LAST_P_DATE'   DATETIME            )
GO

I received an email contaning the folowing query.
I know we can apply that in oracle but I dont think we can apply it on sybase because I had an error

incorrect syntax near the keyword add

IF its incorrect, is there a similar way where I can add several columns at the same time ?


Solution

  • You should remove parenthesis, apostrophes and add null or not null

    ALTER TABLE S_DET 
    ADD SCHETION VARCHAR(1) null,
        FDATE    DATETIME    null,
        TDATE    DATETIME    null,
        SCTIME   VARCHAR(8)  null,
        SCTYPE   VARCHAR(10) null,
        PERY     VARCHAR(10) null,
        P_NB     NUMERIC(2)  null,
        LAST_P_DATE   DATETIME  null           
    GO