How we set Default value for Exiting Column through Query Analyzer

  • Hello,

    How we set Default value for Exiting Column through Query Analyzer. Means i have one column with datatype smalldatetime in table, I want to set Default value for that column instead of adding new column into table. Its easy through Enterprise Manager but how we can do through Qurery Analyzer.

    Plese help me.

    Thanks in advance.

     

     


    Sachin Bhaygude

  • Here is some sample code for you

    CREATE TABLE tblTest

    ([Field1] CHAR(10) NULL) ON [PRIMARY]

    ALTER TABLE [tblTest] ADD

     CONSTRAINT [DF_tblTest_Field1] DEFAULT ('Hi') FOR [Field1]

    GO

    sp_help tblTest



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

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

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