用的是Sqlserver2008R2,给dateTime类型栏位添加默认值的sql是:
alter table table1 alter column TxDate not null default getdate()
老报错:Incorrect syntax near the keyword 'not'.
请各位帮忙看看该如何改正,谢谢了!
alter table table1 alter column TxDate not null default getdate()
老报错:Incorrect syntax near the keyword 'not'.
请各位帮忙看看该如何改正,谢谢了!
还是报错:
Incorrect syntax near the keyword 'default'.
Alter Table dbo.table1 Alter column TxDate datetime not null
GO
ALTER TABLE dbo.tb ADD CONSTRAINT
DF_tb1_txdate DEFAULT getdate() FOR col21
GO
GO
ALTER TABLE dbo.table1 ADD CONSTRAINT
DF_tb1_txdate DEFAULT getdate() FOR TxDate
GO
alter table t add CONSTRAINT TxDate_df default getdate() for TxDate
add constraint DF_tb_tx_Date default getdate() for tx_Date with values