March 15, 2007 at 10:55 am
March 15, 2007 at 11:33 am
March 16, 2007 at 3:44 am
The default is 0 I think
March 16, 2007 at 6:43 am
You need to drop the default constraint first:
ALTER TABLE [dbo].[Invoices] DROP CONSTRAINT constraint_name
GO
ALTER TABLE [dbo].[Invoices] ALTER COLUMN [TotalFees] [money]
GO
ALTER TABLE [dbo].[Invoices] ADD CONSTRAINT constraint_name DEFAULT (0) FOR [TotalFees]
GO
Hope that helps.
March 16, 2007 at 7:02 am
Thanks - unfortunately I don't know the contstraint name - the names have been system defined and are differant across dbs I want to run the code against. Can I do this without knowing the names?
March 16, 2007 at 7:24 am
This should help. This deletes a column and all constraints:
http://www.sqlservercentral.com/scripts/viewscript.asp?scriptid=1855
You'll need to modify it to have it do an alter table/alter column command instead of deleting the column.
March 16, 2007 at 7:32 am
Cheers will give that a go.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply