Scripts

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

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(1)

You rated this post out of 5. Change rating

2004-12-13 (first published: )

245 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

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(1)

You rated this post out of 5. Change rating

2004-12-10 (first published: )

700 reads

Technical Article

Finding first/last day of month by a date

This script finds the first day of previous, current and next month as well as last day of previous, current and next month.The calculation is based on the ISO date format which makes it independant of the date format used on the SQL Server.The calculation is performed from a date - it can be altered […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2004-12-02 (first published: )

284 reads

Blogs

Experimenting with CHOOSE: #SQLNewBlogger

By

I was looking over the CHOOSE() function while editing an article at SQL Server...

Fighting Procrastination?

By

Here is another short video (~ 15 minutes). This is by the author of...

A Fun Prize at the PASS Data Community Summit

By

I had a briefing for the 2026 PASS Data Community Summit, which is just...

Read the latest Blogs

Forums

BCA KCP Summarecon Mall Serpong Telp:0821°7555°651

By R4nt4u

Telp&Wa 628217555651 Down Town Walk, Summarecon Mal Serpong Unit DGF, Jl. Boulevard Raya Gading...

Alamat BCA KCP ITC BSD Telp:0821°8200°203

By m4rt1n4

Telp&Wa 628218200203 Ruko ITC BSD, Jl. Pahlawan Seribu Blok R No. 41 & 42,...

Alamat BCA KCU ALAM SUTERA Telp:0821°8200°233

By layanan_Bca88

Telp&Wa 628218200233 Perumahan Alam Sutera, Jl. Alam Sutera Boulevard No.10A, Pakulonan, Kec. Serpong, Kota...

Visit the forum

Question of the Day

SQL Server 2025 Server-level Roles

In SQL Server 2022+, what does the ##MS_DatabaseConnector## role allow?

See possible answers