altering table

altering table

Post by Dun Ros » Fri, 08 Dec 2000 16:03:38



I need to alter a column from "real" type to "float" type. This column
has a default constrain.
If I try
 alter table MyTable
  alter Column MyColumn float

MS SQL7 failes with
ALTER TABLE ALTER COLUMN MyColumn failed because
 DEFAULT CONSTRAINT DF__PaymentOrde__MyColumn__2D12A970 accesses this
column.

How to alter this table?

 
 
 

altering table

Post by Michael mikuli » Fri, 08 Dec 2000 04:00:00


First, drop constraint with
ALTER TABLE ... DROP CONSTRAINT DF__PaymentOrde__MyColumn__2D12A970

Then change column data type and recreate default constraint.

Hi
Michal

Quote:-----Original Message-----

I need to alter a column from "real" type to "float" type. This column
has a default constrain.
If I try
 alter table MyTable
  alter Column MyColumn float

MS SQL7 failes with
ALTER TABLE ALTER COLUMN MyColumn failed because
 DEFAULT CONSTRAINT DF__PaymentOrde__MyColumn__2D12A970 accesses this
column.

How to alter this table?

.


 
 
 

1. Errors With ALTER TABLE/ALTER COLUMN

Hi,

I had this database, which was denormalized. It is now normalized, however I
have come to changing the column data types, where applicable they are int
and tinyint, i also set an identity column (called code) as a primary key,
when doing so i get the following error msg:

Warning: The table 'tab_people' has been created but its maximum row size
(9361) exceeds the maximum number of bytes per row (8060). INSERT or UPDATE
of a row in this table will fail if the resulting row length exceeds 8060
bytes.

my sql (no pun) for this is:

/* change datatype */
alter table tab_people
alter column reference tinyint

/* apply primary key */
alter table tab_people
add primary key (code)

does anyone have any suggestions as to what the problem is here, and is it a
fatal problem?

thanks for your time,
Alex Wilson


2. Recent postings to comp.databases...

3. ALTER TABLE ALTER COLUMN

4. JDBC-Access through Firewall?

5. ALTER TABLE/ALTER COLUMN problem with MS Access 2K

6. Using Update

7. Alter ALTER TABLE statement ...

8. Converting Problem from nvarchar or varchar to smalldatetime

9. Alter table alter column

10. Alter Table Alter Column Syntax

11. Alter Table - Alter Column - Set Default ?'s

12. Alter table Alter column problem.

13. ALTER TABLE ... ALTER COLUMN IDENTITY