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.
| Author |
Topic |
|
preeti164
Starting Member
2 Posts |
Posted - 2008-12-15 : 18:43:56
|
| I am trying to alter column in tblCustomer and set the default value to 0.Also want to set this column to allow NULL.Below is the statement i am trying and getting the following error.Please help.ALTER TABLE dbo.tblCustomerDetails alter COLUMN Customer1 bit NULL SET DEFAULT '0';Msg 156, Level 15, State 1, Line 2Incorrect syntax near the keyword 'DEFAULT'. |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-15 : 19:05:30
|
| Alter table dbo.tblCustomerDetails Add CONSTRAINT [Defaultname] Default(0) for Customer1 |
 |
|
|
preeti164
Starting Member
2 Posts |
Posted - 2008-12-15 : 19:26:47
|
| Is there a way to drop default. I have a default on my column as 1 and i need to change it to 0. alter table <table_name> alter column <column_name> drop default giving me errors. |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-15 : 19:32:52
|
| Alter table tablename drop constraint <defaultname>You should learn from Booksonline. |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-12-17 : 10:23:40
|
| Hi,Use the below statement u get better resultALTER TABLE dbo.tblCustomerDetails ADD CONSTRAINT DF_tblCustomerDetails1_Customer1 DEFAULT 0 FOR Customer1Be Cool... |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-17 : 10:24:57
|
quote: Originally posted by raky Hi,Use the below statement u get better resultALTER TABLE dbo.tblCustomerDetails ADD CONSTRAINT DF_tblCustomerDetails1_Customer1 DEFAULT 0 FOR Customer1Be Cool...
What I wrote in 12/15/2008 : 19:05:30 ? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-17 : 10:59:50
|
quote: Originally posted by sodeep
quote: Originally posted by raky Hi,Use the below statement u get better resultALTER TABLE dbo.tblCustomerDetails ADD CONSTRAINT DF_tblCustomerDetails1_Customer1 DEFAULT 0 FOR Customer1Be Cool...
What I wrote in 12/15/2008 : 19:05:30 ?
its not first time he's doing this |
 |
|
|
|
|
|