Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
The default constraint does not have any name.
IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'tAccounting' AND COLUMN_NAME = 'CreatedDtm' AND DATA_TYPE = 'datetimeoffset') ALTER TABLE [dbo].[tAccounting] ADD [CreatedDtm] [datetimeoffset] (2) NOT NULL DEFAULT (GETDATE())
GO IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE PARENT_OBJ = OBJECT_ID(N'tAccountingDtl') AND NAME = 'DF_tAccountingDtl_CreatedDtm' AND type = 'D') ALTER TABLE [dbo].[tAccountingDtl] ADD CONSTRAINT [DF_tAccountingDtl_CreatedDtm] DEFAULT (getutcdate()) FOR [CreatedDtm] GO
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Sql case statement to calculate totals||5||37|
|the way to learn Microsoft BI||13||51|
|T-SQL: The transaction log for database 'Logging' is full due to 'LOG_BACKUP'||3||23|
|Estimating my database size||7||21|