/ * - Modify the example of custom data type accuracy
Custom data types are now referenced, they can no longer modify and delete. If you want to modify the accuracy of the data, it is very troublesome. The following example demonstrates how to modify it.
Suppose the custom variable to be modified is called AA
- * /
--1. Modify the name of the custom variable type EXEC SP_RENAME 'AA', 'AA_BAK', 'USERDATATYPE'GO
--2. Add a custom variable (according to new precision) EXEC SP_ADDTYPE N'AA ', N'Numeric (20, 2)', N'Not Null'go
--3. Modified table, use new custom variables
Declare @s varchar (8000) Declare TB CURSOR LOCAL for SELECT 'ALTER TABLE [' Object_name (A.ID) '] AA'FROM syscolumns a join systemypes b on a.xUsertype = B.XUSERTYPEWHERE B.NAME = 'aa_bak'open tbfetch next from tb @Swhile @@ fetch_status = 0begin exec (@s) fetch next from tb @sendclose TBDEAllocate TB