|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
i use the statement below to add a column it will work but when i wanna drop that column it wont work
"ALTER TABLE LA_LeaveBalance ADD abc SMALLINT NOT NULL DEFAULT 3" whereas if i use this statment "ALTER TABLE LA_LeaveBalance ADD abc SMALLINT" it works... and if i use the previous sql statement it gives me an error The object 'DF__LA_Balanc__accBa__540C7B00' is dependent on column 'accBalance'. ALTER TABLE DROP COLUMN accBalance failed because one or more objects access this column. anyone knows wats the problem? thanx Last edited by jeanzz83 : April 4th, 2004 at 03:48 AM. |
|
#2
|
||||
|
||||
|
When you add a field and place a NOT NULL constraint on it. In order to remove that field you must first remove the constraint.
Code:
This will remove the constraint ALTER TABLE LA_LeaveBalance DROP CONSTRAINT DF__LA_Balanc__accBa__540C7B00 This will remove the column ALTER TABLE LA_LeaveBalance DROP COLUMN abc Last edited by Memnoch : November 12th, 2004 at 09:42 AM. |
|
#3
|
|||
|
|||
|
How do i know the contraint?
Hello!
I also add columns dynamicly. If i try to drop a column an error like this occurs. My problem is: how do i know the contraints, the names of the contraints? |
|
#4
|
||||
|
||||
|
In Enterprise Manager, open the table in "Design Mode" and click the "Check Constraints" on the menu bar.
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Alter Table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|