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 […]
2005-06-14 (first published: 2005-05-27)
285 reads
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 […]
2005-06-14 (first published: 2002-07-11)
966 reads
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
2005-06-13 (first published: 2005-05-27)
281 reads
A simple User Function which will guarantee always to return a value from a division without any errorsExample : GPDivNErr(@Val1 float, @Val2 float)
2005-06-10 (first published: 2005-05-29)
459 reads
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 […]
2005-06-09 (first published: 2005-03-30)
234 reads
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 […]
2005-06-08 (first published: 2005-05-19)
344 reads
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 […]
2005-06-07 (first published: 2005-05-19)
1,223 reads