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)
224 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)
250 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)
626 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)
407 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)
185 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)
433 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)
578 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)
861 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,178 reads
SP_SQLSMTPMail is an OLE automation implementation of the CDOSYS dll for Windows 2000 which utilizes a network SMTP server rather than an Exchange server/Outlook client. The stored procedure functions similar to xp_sendmail including the ability to run a query and attach the results. No MAPI profile is required. It is also a working, detailed example […]
2005-10-12 (first published: 2002-10-08)
3,763 reads