Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 unbind default

Author  Topic 

edpel
Starting Member

22 Posts

Posted - 2004-01-09 : 16:23:30
How can I unbind and drop a default if I do not know what column it is attached to?

sp_unbindefault seems to want the table and column name.

Thanks,
Eddie

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-01-09 : 17:43:10
You can't. You have to know which column it belongs to. Script out your schema and find it.

Tara
Go to Top of Page

edpel
Starting Member

22 Posts

Posted - 2004-01-12 : 09:10:25
The problem is this script is part of an 'install' script.

if object_id('default1') is null
alter table table1
add constraint default1 default 'N' for column1
go

The user never saw the default in their table as it was in their database, it was just not bound to any column for some reason so I want to blindly drop it before I try to add it. The problem is, if it is bound to a column, you can't simply drop it so I was trying to unbind it and get rid of it no matter what column it was attached to.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-01-12 : 12:22:42
Then you need to search through the system tables to figure out which column it is bound to, then which table the column belongs to.

Tara
Go to Top of Page
   

- Advertisement -