By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,419 Members | 1,584 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,419 IT Pros & Developers. It's quick & easy.

set default value

P: n/a
dear sir/madam
what is the syntex for changing default value.
table name is test
uno numeric(9)
name1 char(10)
address char(10)

default value of addres is set to 'delhi'

i have to change it to 'patna'

please give me query for it

thanks in advance
Sep 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
what is the syntex for changing default value.
table name is test
uno numeric(9)
name1 char(10)
address char(10)

default value of addres is set to 'delhi'

i have to change it to 'patna'
You first need the constraint name. This can be found with:

EXEC sp_helpconstraint 'dbo.'test'

You can then drop and recreate the constraint by name with a script like the
example below. Just substitute the actual constraint name.

ALTER TABLE dbo.test
DROP CONSTRAINT DF_test_address

ALTER TABLE dbo.test
ADD CONSTRAINT DF_test_address
DEFAULT ('patna') FOR address

--
Hope this helps.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

Sep 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.