Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alter column to change value

Status
Not open for further replies.

babeo

Technical User
Mar 30, 2000
398
CA
Hi
I want to alter a column of a table to change its default setup value, however, it is the index field, I would like to know what should I pay attention before making the change ?
Thanks
 
Hi,

Keep in mind that changing the default value won't affect any existing data (only new INSERT's that don't include a value for the column in question). So the index shouldn't be an issue one way or the other. But you might check the Sybase doc's to see for sure if this is a case where the table will actually be copied to create a new one with the new default--I doubt that it is.

You can avoid using ALTER TABLE and just use sp_unbindefault and then sp_bindefault to (respectively) remove the old default and bind on the new one. This won't affect your index or copy data. To do this, you'll have to have the new default defined (see CREATE DEFAULT), but I think the ALTER TABLE will just do all that for you internally.

HTH,

J M Craig
Alpha-G Consulting, LLC
nsjmcraig@netscape.net
 
Thanks Crag,

So, I did change the value of the column, but when try to add a new record, the old value keeps displaying instead of new one. Should I recycle the database after changing the structure ? (version 11.5.1.2)

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top