IN and NOT IN
One of the most common mistakes made in T-SQL is thinking that these behave identically. I've personally opened up a...
2010-01-28
1,235 reads
One of the most common mistakes made in T-SQL is thinking that these behave identically. I've personally opened up a...
2010-01-28
1,235 reads
After a while, most people who work with SQL have accumulated quite a few scripts that they use for investigation,...
2010-01-20
527 reads
Overview
This is something that most people eventually need for reporting purposes. This function uses a Tally table to 'clean' a...
2010-01-13
4,208 reads
It seems like every blog I read has a list of goals posted for the year. This seems like a...
2010-01-09
348 reads
I see charindex used quite commonly in string manipulation. What I rarely see used is the optional third parameter. Here...
2009-12-21
2,926 reads
I see charindex used quite commonly in string manipulation. What I rarely see used is the optional third parameter. Here...
2009-12-19
4,567 reads
Tally (or numbers) tables are one of my favorite query writing tools. Such a simple premise that can be applied...
2009-12-17
3,185 reads
Tally (or numbers) tables are one of my favorite query writing tools. Such a simple premise that can be applied...
2009-12-14
3,037 reads
Creating a Fabric workspace takes about 30 seconds. Restructuring workspaces after people have built...
By Steve Jones
It’s a small change, but a handy one. Flyway Desktop (FWD) now includes the...
By Steve Jones
Software is hard. While I love our Lucid Gravity, I realize that they are...
Comments posted to this topic are about the item Adding new column with DEFAULT...
Comments posted to this topic are about the item Advanced Deployment Scenarios: Stairway to...
Comments posted to this topic are about the item You Need a DBA Pipeline
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 = 1See possible answers