Link to home
Start Free TrialLog in
Avatar of longdat
longdat

asked on

Drop table columns that are constrained

I have a SQL Server 2005 database .However database tables have one  column(rowguid)  that is constrained by some objects that I don't know so far.Therefore I can't drop this column.This column is allowed to be null.
Please give me a solution to drop this column.
Avatar of ibrusett
ibrusett
Flag of Italy image

You have to remove the constraint and then to drop the column.
To know which is the constraint you can generate the create script of the tabler using SQL Server Management studio, and then drop the costraint (again you ca do it from SQL Server Management studio, navigating the tree view under the table -> constraint)
Avatar of Aneesh
I dont really understand why you are trying to delete this column. In case, some foreign key constraint is defined on this column then u need to find the columns which is related to this columns , if you need to delete those columns also, drop them all first , then drop the constraint and that particular column
Avatar of longdat
longdat

ASKER

Actually, problem is that when I do replication, database is automatically added one column (rowguid) on every table with a lot of constraints.Now I want to drop this column in order to export file.
ASKER CERTIFIED SOLUTION
Avatar of jogos
jogos
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial