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.Why are using dynamic SQL in the first place?|||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.|||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?|||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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment