Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2002
    Posts
    58

    Unanswered: alter table without data type

    I would like to set a field to not null which I can do like this: ALTER TABLE table1 ALTER COLUMN field1 BIGINT NOT NULL

    My question is there anyway to set this field to NOT NULL without having to specify the data type BIGINT? I'm using dynamic sql and if there was a way then I wouldn't need to go get the data type of the field dynamically and it would save me a step. Thanks.

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Why are using dynamic SQL in the first place?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Feb 2002
    Posts
    58
    I'm creating tables from a DB2 database and importing it's data. I have to dynamically do this because the tables on the DB2 side are constantly changing.

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    So when the tables change (and yes you need to supply the datatype) in DB2, how do you apply the schema changes? Are you using ERWin?

    And what do you mean by constantly? Is this a production database?

    And what schema changes are you applying....I mean it could get kind of hairy doing everything....indexes, constraints...it could get ugly...

    Are you taking those things in to account?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Feb 2002
    Posts
    58
    I'm doing a full refresh (drop/create) of the tables. Not using ERWin, just stored procedures.

    "Constantly" may be a bad term. It is a production database (DB2 side) so the changes are minimal, but I do not want to maintain changes on the MSSQL side.

    I created a table to relate keys of different tables I'm pulling in. So the schema I'm developing is controlled.

    It's looking like the best way to do this is to see if the column needs to be NOT NULL on creation.

Posting Permissions

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