Results 1 to 5 of 5

Thread: Alter Table

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    11

    Question Alter Table

    Hi,

    I'm fairly new to programming with SQL Server database and don't know where to start. Here is my situation. I have a SQL server database and I want to add two new fields to an existing table. Each of the field will have values of either 0 or 1. I want to have a script or procedure to do this? Where would I do this? In the Query Analyzer?

    Thanks in advance!

  2. #2
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611
    See this example:
    VB Code:
    1. BEGIN TRANSACTION
    2. SET QUOTED_IDENTIFIER ON
    3. SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
    4. SET ARITHABORT ON
    5. SET NUMERIC_ROUNDABORT OFF
    6. SET CONCAT_NULL_YIELDS_NULL ON
    7. SET ANSI_NULLS ON
    8. SET ANSI_PADDING ON
    9. SET ANSI_WARNINGS ON
    10. COMMIT
    11. BEGIN TRANSACTION
    12. ALTER TABLE dbo.T_table ADD
    13.     ndRelTandarts bit NULL,
    14.     ndSrtRelTandarts bit NULL,
    15. GO
    16. COMMIT
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    Set statements within a separate transaction???? Interesting!

    Just a note: Bit fields cannot be Null.

    Query Analyzer can be used to execute your statements.

  4. #4
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Re: Alter Table

    Originally posted by QAnalysis
    Hi,

    I'm fairly new to programming with SQL Server database and don't know where to start. Here is my situation. I have a SQL server database and I want to add two new fields to an existing table. Each of the field will have values of either 0 or 1. I want to have a script or procedure to do this? Where would I do this? In the Query Analyzer?

    Thanks in advance!
    In the future, please do not post on multiple boards.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    11
    How would you set default value of that column to 0 if I use [smallint]? Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width