Demonstration on how to pivot data using temp tables
This script was designed to 'pivot' data that couldnt easily be pivoted in any other way. i used temporary tables to eventually achieve the result i was looking for π
2008-10-10
1,063 reads
This script was designed to 'pivot' data that couldnt easily be pivoted in any other way. i used temporary tables to eventually achieve the result i was looking for π
2008-10-10
1,063 reads
Lists details for all indexes on one or more tables / schemas, including row count and size. This version outputs the member seek + include columns as two comma separated output columns.
2008-10-09 (first published: 2008-08-01)
2,517 reads
This script is for the Generating a code block that makes it easier to grant various permissions on a group of objects qualified by specific Criteria.
2008-10-08 (first published: 2008-07-23)
1,332 reads
It is very common to want to drop a table, if it exists, before creating it. This script does so, and it works well with temp tables (where the system views are harder to query).
2008-10-06
2,730 reads
All of us have problems with Duplicate rows, here is a simple and efficient way of removing duplicate rows
2008-10-03 (first published: 2008-07-18)
1,693 reads
How to use DDL triggers and Query the Data with minimum performance impact.
2008-10-02
1,843 reads
2008-10-01 (first published: 2008-07-24)
2,719 reads
2008-09-30 (first published: 2008-07-24)
897 reads
A short script you can incorporate into any 2005/2008 code to get the full schema.table.
2008-09-29
669 reads
Script to return Rows count from table using sp_ExecuteSQL
2008-09-26 (first published: 2008-07-20)
1,553 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