Setting default value of field...having problems

Setting default value of field...having problems

Post by Joey Marti » Wed, 28 Jan 2004 15:02:38



I need to set the default value of a field. Pretty simple task. But
there is quite a bit of text to use. Doing this in Enterprise Manager is
only allowing me to enter some text. Is there a query that will allow me
to update the default value of a field?

My field type is TEXT so I know I have plenty of space.

Thanks!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
 
 

Setting default value of field...having problems

Post by Jacco Schalkwij » Wed, 28 Jan 2004 15:17:53


Hi Joey,

First you have to drop the exisiting constraint:
ALTER TABLE <table name> DROP CONSTRAINT <constraint name>
and then you can recreate it

ALTER TABLE <table name> ADD CONSTRAINT <constraint name> DEFAULT <value>
FOR <column name>

I wonder why you need a default for a text column though, specially if it is
apparently a large amount of data as well. You will have a lot of data in
your database that doesn't have much value if you do that.

--
Jacco Schalkwijk
SQL Server MVP


Quote:

> I need to set the default value of a field. Pretty simple task. But
> there is quite a bit of text to use. Doing this in Enterprise Manager is
> only allowing me to enter some text. Is there a query that will allow me
> to update the default value of a field?

> My field type is TEXT so I know I have plenty of space.

> Thanks!

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!