Shrink all databases
Procedure changes all databases' recovery mode to simple and shrinks them all (or at least it tries to).
2012-03-07 (first published: 2008-01-14)
3,894 reads
Procedure changes all databases' recovery mode to simple and shrinks them all (or at least it tries to).
2012-03-07 (first published: 2008-01-14)
3,894 reads
This terse script shows an easy (but "dirty" - so not advisable for production environments - rather for personal use) way to select data from stored procedure.
2011-12-14 (first published: 2008-03-04)
4,144 reads
The procedure below deletes all records from the specified database's(except master, model, msdb and tempdb) tables (except those from the schema 'sys').
2011-12-09 (first published: 2008-01-31)
4,174 reads
The script shows one of ways generating number sequence - this one uses CTE.
2011-10-04 (first published: 2008-02-06)
1,908 reads
This procedure works like the sp_spaceused procedure but this one shows statistics for all tables in the selected database or for all databases (excluding tempdb and model).
2011-05-25 (first published: 2008-03-05)
10,126 reads
This procedure searches for a specified text in all (or one selected) databases in all (or selected) tables.
2011-03-02 (first published: 2008-01-25)
5,069 reads
2011-03-01 (first published: 2011-02-18)
3,987 reads
This procedure searches for the specified GUID (or its part) in all (or selected one) databases
2011-02-21 (first published: 2008-01-24)
910 reads
This procedure is supposed to compare structure (tables, procedures, triggers, foraign keys etc.) of two specified databases.
2008-10-27 (first published: 2008-08-19)
3,066 reads
Created view displays all text columns' collations in the current database with the information whether
the collation is different from the database's one.
2008-04-04 (first published: 2008-01-22)
1,699 reads
By Kevin3NF
Common Reasons for Emergency SQL calls If you are a production DBA (or Accidental...
By Steve Jones
I grabbed this book over the 2024 holiday season as it was on sale...
By Steve Jones
Investing small amounts of money over a long time works miracles, but no one...
When running clone sql is changing one specific table to History table and its...
Comments posted to this topic are about the item What is time?
Hello experts, The following SQL update is failing to install on some of our...
Consider the following script for a Sql Server database with Compatibility Level at least 130 (Sql Server 2016):
create table tjson ( id int primary key, j1 varchar(max), j2 varchar(max), j3 varchar(max)); insert into tjson (id, j1, j2, j3) values (1, '[{"c11":"value11A", "c12":"value12A"},{"c11":"value11B", "c12":"value12B"}]', '[{"c21":"value21A", "c22":"value22A"},{"c21":"value21B", "c22":"value22B"}]', '[{"c31":"value31A", "c32":"value32A"},{"c31":"value31B", "c32":"value32B"}]');How many rows does the Query Optimizer estimate for the following query?
select id, c1.c11, c2.c21, c2.c22, c3.c31, c3.c32 from tjson cross apply openjson(j1) with( c11 varchar(50) '$.c11', c12 varchar(50) '$.c12') c1 cross apply openjson(j2) with( c21 varchar(50) '$.c21', c22 varchar(50) '$.c22') c2 cross apply openjson(j3) with( c31 varchar(50) '$.c31', c32 varchar(50) '$.c32') c3;See possible answers