To unbind the default from the table, we use sp_unbindefault: : sp_unbindefault « System « SQL Server / T-SQL






To unbind the default from the table, we use sp_unbindefault:

 


8> CREATE TABLE Employees (
9>      EmployeeID int IDENTITY (1, 1) NOT NULL ,
10>     LastName nvarchar (20) NOT NULL ,
11>     FirstName nvarchar (10) NOT NULL ,
12>     Title nvarchar (30) NULL ,
13>     TitleOfCourtesy nvarchar (25) NULL ,
14>     BirthDate datetime NULL ,
15>     HireDate datetime NULL ,
16>     Address nvarchar (60) NULL ,
17>     City nvarchar (15) NULL ,
18>     Region nvarchar (15) NULL ,
19>     PostalCode nvarchar (10) NULL ,
20>     Country nvarchar (15) NULL ,
21>     HomePhone nvarchar (24) NULL ,
22>     Extension nvarchar (4) NULL ,
23>     Photo image NULL ,
24>     Notes ntext NULL ,
25>     Salary int NULL ,
26>     PhotoPath nvarchar (255) NULL
27>
28> )
29> GO
1>
2>    CREATE DEFAULT SalaryDefault
3>       AS 0
4> GO
1>    EXEC sp_bindefault 'SalaryDefault', 'Employees.Salary'
2>
3> GO
Default bound to column.
1>
2>    EXEC sp_unbindefault 'Employees.Salary'
3>
4> GO
Default unbound from table column.
1> drop DEFAULT SalaryDefault;
2>
3> drop table Employees;
4> GO
1>
2>

 








Related examples in the same category