Default

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

Hi

Can you explain/or show how to create a table to have the columns default to blank space instead NULL when there is no value. and the datatypes of the various columns could be decimal, float, char etc.

Thanks

-- Anonymous, December 20, 2000

Answers

Justin,

You can use Transact SQL to add a constraint such as:

ALTER TABLE [dbo].[TableName] WITH NOCHECK ADD CONSTRAINT [DF_TableName_ColumnName] DEFAULT ('') FOR [ColumnName]

GO

I don't understand the second part of your question though. Numeric columns cannot be defaulted to blank.

Hope this helps,

Eric

-- Anonymous, December 23, 2000


Moderation questions? read the FAQ