I saw a posting recently of a DBA not being able to truncate a transaction log. I rememberred this script that I had, (downloaded from Microsoft Support many moons ago), which did the job for me. It basically filled the log with data, then truncated and shrank the log. All important points throughout the script […]
2005-10-28 (first published: 2005-09-26)
402 reads
Consider an employee table containing name and age of the employees. Write a script to retrieve the row which contain the details of the employee whose age is 50 and also retrieve the immediate next and previous rows
2005-10-27 (first published: 2005-09-28)
238 reads
This script modifies another excellent script written by SHAS3. The original script examines tables for changes and sends an email. This modification examines all stored procedures, tables, indexes, etc. in ALL databases or just the CURRENT database. If changes are detected, the script has the option to either email or log to a table that […]
2005-10-26 (first published: 2005-09-28)
258 reads
This script outputs the TSQL code to do perform an 'Upsert'.It depends on both the source & target tables having the same structure and rows being uniquely identified with a single field.Three variables need to be updated prior to execution of this script:@SourceTable: Table containing the data to be upserted@TargetTable = Table to be upserted […]
2005-10-25 (first published: 2005-09-30)
659 reads
When you tell Enterprise Manager to "Create one file per object" when scripting objects from the database it gives those scripts a PRC extension.Unfortunately SQL Query Analyser defaults to a .SQL extension.The following DOS command renames all .PRC files to .SQL
2005-10-24 (first published: 2005-09-30)
451 reads
This script will create SQL Server top level groups in EM and then register a bunch of SQL Servers in their respective groups.The script maybe modified to as needed if the user does not wish to create groups. The script currently reads the list of servers tobe registered from a SQL Server database but could […]
2005-10-21 (first published: 2005-10-05)
199 reads
The script is not as complete (and complex) as the USP_GetJobSchedules from M.Pearson, M. Austin and R.Sotkiewicz, but it gives a list of the scheduled jobs with start time, name, frequency, category and whether is enabled or not
2005-10-20 (first published: 2005-10-05)
442 reads
Getting "Subquery returned more than 1 value" error on cursors. Changed the following in a couple of places and it runs now. systypes.[name], --(SELECT systypes.[name] FROM systypes WHERE xtype = syscolumns.xtype), Mny thanks to whomever wrote the script. Saved me a bunch of effort."This script will document tables (including constraints and triggers, row counts, sizes […]
2005-10-19 (first published: 2005-10-07)
591 reads
This SQL script returns a recordset with all the index information for all tables within a database
2005-10-18 (first published: 2005-10-07)
870 reads
Use this script as part of your data warehouse projects. I created this script based on previous postings of the Date/Time Dimension. I wanted a dimension that does hours, minutes and seconds. Includes military and standard hours.
2005-10-13 (first published: 2005-10-11)
5,298 reads