February 27, 2008 at 1:55 pm
U CAN UPDATE THAT WAY ONLY WHEN THERE ARE NO MORE ROWS TO BE INSERTED IF NOT EVERYTIME U INSERT SOME ROWS U NEED TO UPDATE THE COLUMN .....SO IT JUS APPLIES TO THE EXISTING ROWS...NOT FOR THE COLUMN PERMANENTLY..BETTR U JUS FOLLOW THE CONSTRAINTS IT WRKS .....PLZ LET ME KNOW ....
I think you misunderstood what I said. I am saying for the OP to apply the default value constraint, which may not automatically update the table data. If the table data is not automatically updated then the OP will have to update the data before altering the column to not null.
And yes the OP should definitely enforce the constraint.
February 27, 2008 at 2:04 pm
YA GOT IT BUT WHEN U SAY THAT THE OP SHOULD BE CHANGED IT MEANS THE TOTAL NO OF ROWS IN THE TABLE SHOULD BE UPDATED TO O FROM NULL SO THAT U CAN CHANGE IT TO NOT NULL FROM NULL ...IS THAT SO....
Thanks,
Chinna
Its the Journey which gives you Happiness not the Destination-- Dan Millman
February 28, 2008 at 8:53 am
...
alter table mytable alter column colname int not null;
cheers,
R
February 28, 2008 at 8:55 am
alter table myta[font="Tahoma"][/font]ble alter column mycolumn int not null;
cheers,
R
February 28, 2008 at 10:57 am
You would have to first update all the rows with null values to 0 using an update statement
update Mytablename set colA = 0 where colA is null
Then you should be able to alter column to not null
ALTER TABLE Mytablename ALTER COLUMN colA Datatype Not Null
February 29, 2008 at 11:17 am
In order to set the column to not allow nulls, you will have to do an update to set all of the columns that contain a null to some default value first (I think you wanted a zero there). Then you can alter the column to not allow nulls.
Todd Fifield
March 1, 2008 at 9:34 pm
JUS ROGHT CLICK ON THE TABLE AND CLICK MODIFY AND JUS UNCHECK THE NULL BOX...THATS IT THKZ ADAM...
it doesnt work that way it gives error when data is large, every 1 knows that option.
thank you guys for such a response. i have done a fix of that, but null values do popup errors sometimes
<a href="http://www.websolsoftware.com"> For IT jobs click here</a>
*Sukhoi*[font="Arial Narrow"][/font]
Viewing 7 posts - 16 through 21 (of 21 total)
You must be logged in to reply to this topic. Login to reply