List sizes of tables in database
This script will list the spaceused by all tables in a database. You can order the output by changing one of the parameters.It also provides totals
2002-10-27
686 reads
This script will list the spaceused by all tables in a database. You can order the output by changing one of the parameters.It also provides totals
2002-10-27
686 reads
This script returns the latest package log for the DTS package specified in the @package_name variable. The interface for viewing DTS package logs through Enterprise Manager is limited in the fact that it doesn't provide textual descriptions of the values for the Step Execute Status and Step Execute Results. This makes it difficult to trace […]
2002-10-22
629 reads
Have seen existing scripts to work out number of days in month. They tend to work out the month, and then whether it's a leap year.Another approach is to take the date passed in, find the first day of the next month, and then use Datadd to take off one day, ie: last day of […]
2002-10-17
442 reads
This SP will only work on SQL Server 2000 and can be placed in your master database. sp_CreateAndExecTableScript is designed to script one table and create an identical table. I designed it to use with DTS packages so that I can create an identical table with a different name, pump data into the table and […]
2002-10-15
2,557 reads
What's this error:Arithmetic overflow error converting IDENTITY to data type int? It was a new one to me, but read on to find out what it means.
2002-10-14
7,020 reads
Ever needed to pause in a SQL script? Or wanted to simulate a long running process for testing? This stored procedure accepts an integer and pauses for that many seconds.
2002-10-04
1,243 reads
Quick and dirty script to generate the required SQL to reinstate permissions on each user object. This can be saved off for DR purposes.
2002-09-24
458 reads
I keep seeing people using CONVERT to convert a date to a varchar in order to do comparison or search queries. I haven't seen a situation yet where DATEDIFF can't be used.
2002-08-29
1,243 reads
Big transactions cause the Tlog to grow.When you do a clean of a large table, the delete statement can cause a very long transactionSometimes it's necessary to prevent this.So we divide one big delete into several little ones.A table with call centre data gets +/- 1-mlj records a day. Every day we run a script […]
2002-08-27
828 reads
Assuming we have the following table (that stores hierarchical data) :CREATE TABLE [staff] ( [employee] [int] NOT NULL , [employee_name] [varchar] (10) NULL , [supervisor] [int] NULL , PRIMARY KEY CLUSTERED ( [employee] ) ON [PRIMARY] , FOREIGN KEY ( [supervisor] ) REFERENCES [staff] ( [employee] ))I ‘ll built a […]
2002-08-23
849 reads
By Steve Jones
It’s Prime Day. A few of my recommendations, since I want to do some...
With Fabric Mirroring, Microsoft is promoting a nice and appealing story for operational reporting...
If you’ve been watching AI roll through the data community and thinking, “this seems...
Comments posted to this topic are about the item SQL Art, Part 4: Happy...
Comments posted to this topic are about the item Concurrency and Baseline Control: Level...
Comments posted to this topic are about the item Spending Time in the Office
I have this code on SQL Server 2022. What happens when it runs all at once?
DROP TABLE IF EXISTS dbo.Commission GO CREATE TABLE dbo.Commission (id INT NOT NULL IDENTITY(1,1) CONSTRAINT CommissionPK PRIMARY KEY , salesperson VARCHAR(20) , commission VARCHAR(20) ) GO INSERT dbo.Commission ( salesperson, commission) VALUES ( 'Brian', 12 ), ( 'Brian', 'None' ) GOSee possible answers