Scripts

Technical Article

Number of Weekdays between two dates - Set Based

Inspired by a post here at SQLServerCentral, I wrote this function to calculate the number of days between two dates that are weekdays. In order to achieve this I used a common SQL table that contains a sequence of number for 1 to X. This was used as an input to the datediff function, and […]

You rated this post out of 5. Change rating

2004-12-24 (first published: )

299 reads

Technical Article

Retrieving all indexes of the Database.

The Script outputs all the indexes in the Database.I have used the sp_helpIndex system stored procedure here to retrieve all the indexes available for the Table . This is extremely useful in identifying all the indexes in a database in a single query

5 (2)

You rated this post out of 5. Change rating

2004-12-22 (first published: )

320 reads

Technical Article

Update multiple rows (in a set) using a single SP

Here is another variation of processing multiple records with a single procedure call but allowing for set processing.The helper functions make use of the sequencetable pattern. These helper functions can be used to parse strings into records, so one gets a list, or simply return the nth field.There are two functions that will parse into […]

You rated this post out of 5. Change rating

2004-12-17 (first published: )

774 reads

Technical Article

Large auto-job-creation script for adding backups

This script creates a stored proc that was intended to run from a trigger on the master..sysdatabases for each database creation. Alas. It will create three jobs for each database you apply it to. First, it'll create a job to run a full backup each Sun, at 5am (see below). Those backups will be retained […]

You rated this post out of 5. Change rating

2004-12-16 (first published: )

373 reads

Technical Article

Auto Fix Orphaned Users

Add this procedure to the master database, it can then be executed from any DB to fix orphaned users (very useful when moving back to development). Using sp_msforeachdb with the proc allows you to resolve orphaned users in all databases in a single command: SP_MSFOREACHDB "USE ?; EXEC SP_AUTOFIX_USERS;"

You rated this post out of 5. Change rating

2004-12-15 (first published: )

2,830 reads

Technical Article

Build DATELOOKUP table

This script creates a table named DATELOOKUP which is used for looking up date related values. Each record represents date related info about the date in the column dtDate. For example the iMonth column stores the integer value of the month of dtDate and sShortMonth stores the abbreviated name of that same month. Use this […]

5 (1)

You rated this post out of 5. Change rating

2004-12-13 (first published: )

202 reads

Technical Article

Where_Am_I

This SP takes a string to be searched as input parameter, loops through all tables, views, Sp-s in the database andreturns the name of the object it was found and number of occurences

5 (1)

You rated this post out of 5. Change rating

2004-12-10 (first published: )

654 reads

Blogs

Spark Connect Dotnet November 2024 Where are we?

By

All Spark Connect Posts Introduction There have been quite a few changes in the last...

A New Word: Ochisia

By

ochisia – n. the fear that the role you once occupied in someone’s life...

Create a Numbers Table in Power Query

By

This is a quick blog post, mainly so I have the code available if...

Read the latest Blogs

Forums

Writer methods in PowerQuery (LOL)

By pietlinden

I'm using PowerQuery in Excel on my desktop. (Yeah, I know you can do...

Need help with GROUP BY...

By iamjoe

Here's my data... I am trying to return total days in status for each...

Need help with GROUP BY...

By iamjoe

Here's my data... I am trying to return total days in status for each...

Visit the forum

Question of the Day

The Density Vector

When building statistics, there is the concept of density that refers to the duplicates in a table. How is this calculated?

See possible answers