Scripts

Technical Article

Latest DTS Package Log

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 […]

You rated this post out of 5. Change rating

2002-10-22

619 reads

Technical Article

WorkingDaysDiff complementary UDF for DATEDIFF

We frequently have to work out a date based on a number of working days before or after a specified date, excluding Saturdays and Sundays.Attached is the script to create the function.  I call another function called fn_Midnight which was designed to help whe programmers get a date with no time portion without having to […]

You rated this post out of 5. Change rating

2002-10-22

479 reads

Technical Article

Format a DOS date as yyyymmdd

Do you run jobs that call BAT files where you wish you could include a formatted date stamp in the output name of an OSQL file? Well, you can using the DOS 'FOR' command. I named a variable FILEDATE and use it as: path\Filename_%FILEDATE%.txt (Note: A BAT file requires double %% in the 'FOR' command […]

4.5 (2)

You rated this post out of 5. Change rating

2002-10-21

1,095 reads

Technical Article

Get Number of Days in month

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 […]

4 (1)

You rated this post out of 5. Change rating

2002-10-17

415 reads

Technical Article

sp_checksqlversion

How many times have you seen @@version return a number but failed to interpret what service pack it is? Although SQL 2000 gives a gift (SERVERPROPERTY) of querying a readable value, my script will remedy the puzzle and show more parameters such as CPU speed, memory, windows version, and installation date. The limitations are:1. MSDE […]

You rated this post out of 5. Change rating

2002-10-16

454 reads

Technical Article

Create And Execute Table Script (SQL Server 2000)

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 […]

5 (3)

You rated this post out of 5. Change rating

2002-10-15

2,515 reads

Technical Article

Linked SQL Servers,  databases, and users Report

Fixed user protion of the script. Sorry had the test script mixed with prod. I was asked to create a report listing all of our SQL Servers, and the databases on them. I was also asked to list everyone that has access to each database and whether it was a standard, windows or windows group […]

You rated this post out of 5. Change rating

2002-10-15

1,053 reads

Blogs

A New Word: Lilo

By

lilo– n. a friendship that can lie dormant for years only to pick right...

Learning Database Design and Power BI Performance

By

I spend my days working on and managing SQL Server instances—working days at least,...

Free SQL Training: Dive into Databases This December!

By

Want to learn SQL and get some real practice this December? Check out the...

Read the latest Blogs

Forums

how to calculate an average only if a minimum number of records exist?

By water490

Hi I am working on a rolling average calculation that is not working quite...

Subscribing to a Great New Year

By Louis Davidson (@drsql)

Comments posted to this topic are about the item Subscribing to a Great New...

dont want pkg to abort if someone is in excel source document

By stan

Hi, is there a way when using excel as a flat file source in...

Visit the forum

Question of the Day

The Funny Dynamic SQL

What happens when I run this code:

EXEC sp_executesql N'PRINT 1; GO';

See possible answers