SQL Server 365

Blogs

Build a C++ Pipeline with Docker, GitHub Actions, Azure ACR and Azure App Service

By

In today’s Software Development Life Cycle (SDLC), having a robust build pipeline is very...

Better Trigger Design: #SQLNewBlogger

By

I had someone ask me about using triggers to detect changes in their tables....

SQL Server in the Cloud – Are DBAs Still Needed?

By

Things your cloud vendor may not tell you   Here’s a common theme I...

Read the latest Blogs

Forums

Adding Defaults

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Adding Defaults

Getting year part out of a string that represents a date

By blom0344

Hi, I have a requirement to fetch the year from an imported .csv  file...

Dropping a PK constraint.

By stevec883

I will have to test this next week, but will not have a chance...

Visit the forum

Question of the Day

Adding Defaults

I have a table, called dbo.logger, in SQL Server 2022. I decide to add two new columns to this table with this code.

ALTER TABLE dbo.logger ADD CreateDate DATETIME CONSTRAINT dfGetDate DEFAULT GETDATE()
GO
ALTER TABLE dbo.logger ADD ModifyDate DATETIME DEFAULT dfGetDate
GO
What happens when I run these two batches?

See possible answers