Home > database >  The database to add attributes and data types
The database to add attributes and data types

Time:10-17

There is a problem is for the total amount of the product table to add a new attribute data type to double the default value is 0 does not allow null

Should add how to write is the alter table products, total amount of the double, is not null, the default=0,,,, not too will say

CodePudding user response:

 USE tempdb for 
GO
IF OBJECT_ID (" test ") IS NOT NULL
DROP TABLE test
GO
CREATE TABLE test (
Id INT PRIMARY KEY,
N NVARCHAR (20)
)
GO
- above for tempdb for temporary library to create a test table

- follow this
Total amount of the ALTER TABLE test the ADD a DECIMAL (18, 2) NOT NULL DEFAULT (0)

CodePudding user response:

If the table has to add one of these things that are not allowed to empty the default value is 0 where should add

CodePudding user response:

SQL script to modify properties method
Add columns default value method
  • Related