Damian is Microsoft MVP and Certified Trainer with 20 years of experience. Now trying to share the passion and knowledge among others. He runs the blog with his daughter as she is really passionate about technology

Person Stirring Coffee with a Spoon

Weekly reading #21

Hello, hello! We have just started new week! We missed the weekly reading last time due to travelling across the Europe over the weekend. There is however a lot...

2019-07-15

48 reads

Weekly reading #20

Being MVP for the #11 straight year is something unique! Thank you! The first week of July has just started. So oficially we have started vacations and the team...

2019-07-01

21 reads

Coffee

Weekly reading #19

Good afternoon folks! It is Monday Tuesday already after a long weekend in Poland. I do not know what temperature you have but here we are like in a...

2019-06-25

26 reads

Breakfast by the sea image

Weekly reading #18

Ready for vacations? The CodingFamily team is almost ready – we have some vacations plans including great conferences during summer and in the autumn. T-SQL bugs, pitfalls, and best...

2019-06-17

26 reads

Round Table of Coffee

Weekly reading #0x10

This is the blog anniversary! 16th Weekly reading has come into the light! For great articles and a video wait for you! Report Parameter Support for Paginated Report E-Mail...

2019-06-03

26 reads

Cup and Saucer

Weekly reading #15

SQLDay 2019 is gone. The Data Community.PL has now a new goal – it is the SQL Saturday #914 in Torun. The speakers will be announced after July 30th....

2019-05-27

27 reads

Blogs

Prep data for AI vs. Fabric Data Agent Instructions: What Goes Where?

By

Making Data AI-Ready, Part 3 (This is the final article in a three-part series...

Keeping Track of my ConEmu CLIs

By

I use ConEmu for my terminal interface. I’m still on Windows 10 at home,...

10 Decisions to Make Before You Create A Fabric Workspace

By

Creating a Fabric workspace takes about 30 seconds. Restructuring workspaces after people have built...

Read the latest Blogs

Forums

Adding new column with DEFAULT II

By Thomas Franz

Comments posted to this topic are about the item Adding new column with DEFAULT...

Advanced Deployment Scenarios: Stairway to Reliable Database Deployments Level 7

By Massimo Preitano

Comments posted to this topic are about the item Advanced Deployment Scenarios: Stairway to...

You Need a DBA Pipeline

By Steve Jones - SSC Editor

Comments posted to this topic are about the item You Need a DBA Pipeline

Visit the forum

Question of the Day

Adding new column with DEFAULT II

Which number did the two COUNT(*) return:

DROP TABLE IF EXISTS #tmp
CREATE TABLE #tmp (id INT NOT NULL)

INSERT INTO #tmp (id) 
SELECT gs.value
  FROM GENERATE_SERIES(1, 5) AS gs

ALTER TABLE #tmp ADD my_value INT NOT NULL CONSTRAINT df_tmp_my_value DEFAULT 1

SELECT COUNT(*)  FROM #tmp AS t WHERE my_value = 1

ALTER TABLE #tmp DROP CONSTRAINT df_tmp_my_value

ALTER TABLE #tmp ADD CONSTRAINT df_tmp_my_value DEFAULT 2 FOR my_value

SELECT COUNT(*)  FROM #tmp AS t WHERE my_value = 1

See possible answers