Scripts

Technical Article

Return WeekNo (ISO 8601 standard)

In MS SQL, January 1 of any year defines the starting number for the week. The DATEPART(wk, 'Jan 1, xxxx') always return 1. However, a lot of reports Week No is actually based on ISO 8601 standard, that is January 1 of any year can be Week 53/52 or Week 1. (http://www.merlyn.demon.co.uk/weekinfo.htm#IDC)The Rule is as […]

You rated this post out of 5. Change rating

2005-06-14 (first published: )

285 reads

Technical Article

sp_RemoveLogin

Ever have trouble removing logins because of onwership issues and permission grants? This stored procedure checks for a login (sql or nt) on the local server and if found it then checks each database for ownership issues and granted permissions. The rules for action taken are listed in the header of the stored procedure. Works […]

5 (1)

You rated this post out of 5. Change rating

2005-06-14 (first published: )

966 reads

Technical Article

IsDateAHoliday UDF

This is a User Defined Function that returns a 1 if date is a holiday else, it returns a 0.The holidays are:New years Day, MLK Day, Presidents Day, Memorial Day, Independance Day, Labor Day, Columbus Day, Veterans Day, Christmas Eve and Christmas Day

4 (1)

You rated this post out of 5. Change rating

2005-06-13 (first published: )

281 reads

Technical Article

ufn_vbintohexstr

A function to convert varbinary to hex string. Have you every tried to deal with varbinary via T-SQL? Passwords and SIDs are of this datatype. In Query Analyzer this datatype displays as hex string but under the hood it is binary. Try concatenating a varbinary to a string in a print statement and you get […]

5 (2)

You rated this post out of 5. Change rating

2005-06-09 (first published: )

234 reads

Technical Article

Restore Database from MDF file without LDF

Hai raino,I saw ur query posted in SQLServerCentral.It was very useful.But if try to run the querydbcc traceon(3604)dbcc rebuild_log ('Training','Training_Log')Its showing the error=================Error================DBCC execution completed. If DBCC printed error messages, contact your system administrator.Server: Msg 5105, Level 16, State 2, Line 2Device activation error. The physical file name 'Training_LOG' may be incorrect.DBCC execution completed. If […]

You rated this post out of 5. Change rating

2005-06-08 (first published: )

344 reads

Technical Article

build_restore_script

This script originally created by Greg Larsen has been modified by me. This procedure is used to create the restore commands needed to restore a database using the lates full and any transaction or differential backups. The parameter @dbname was added to just create the restore statements for a particular database. Leaving off this parameter […]

4.8 (5)

You rated this post out of 5. Change rating

2005-06-07 (first published: )

1,223 reads

Technical Article

Source system pre-integration analysis

Initial analysis of a new source system can be quite time consuming to manually examine tables and columns to determine which even have worthwhile values in the first place. Running this script against the current database will generate useful information for all the columns of all the tables. Details include data types with varchar lengths, […]

5 (1)

You rated this post out of 5. Change rating

2005-06-07

445 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

How Do You Patch 100 Database Servers?

By Steve Jones - SSC Editor

Comments posted to this topic are about the item How Do You Patch 100...

Microsoft SQL announcements at PASS Data Community Summit 2024

By Press Release

Comments posted to this topic are about the item Microsoft SQL announcements at PASS...

How to Develop Custom T-SQL Code Snippets in Azure Data Studio

By Noman072

Comments posted to this topic are about the item How to Develop Custom T-SQL...

Visit the forum

Question of the Day

What's the Ceiling?

What do I get as the results from this code?

SELECT CEILING (999.999), CEILING (-999.999);

See possible answers