467,915 Members | 1,314 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

set default value

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
  • viewed: 2079
Share:
1 Reply
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.

Similar topics

29 posts views Thread by John Wood | last post: by
74 posts views Thread by Zytan | last post: by
10 posts views Thread by Brad Baker | last post: by
4 posts views Thread by Macneed | last post: by
7 posts views Thread by =?Utf-8?B?Y291Z2FyaXN0aWM=?= | last post: by
43 posts views Thread by kenneth | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.