General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
>Joe,
>
>I think you solution is very close. What about modifying the DEFAULT constraint instead of dealing with DEFAULT objects.
>
>CREATE PROCEDURE ChangeDefaultTaxRate
> @newrate decimal(6,3)
>AS
>
>DECLARE @cmd varchar(1000)
>SET @cmd = 'ALTER TABLE customer ADD CONSTRAINT df_taxrate DEFAULT ( ' + CONVERT(varchar(20), @newrate) + ') FOR cu_taxrate'
>
>ALTER TABLE customer DROP CONSTRAINT df_taxtrate
>EXECUTE (@cmd)
>
>
>-Mike
That's cool. I just got into the habit of using "canned" defaults in all my databases since they're reusable.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only