This simple script (ran from the master database) in Query Analyser removes all the requirements of collating currently connected spids to a database and the need to systematically open a cursor to kill each spid individually by simply placing the database offline, then immediately online.
2007-03-16 (first published: 2007-02-13)
366 reads
CREATE FUNCTION [dbo].[GetDateTimeOfIsoWeek](@WeekYearNumber int, @DayNumber int)RETURNS datetime
2007-03-15 (first published: 2007-02-13)
118 reads
SQL 2005 user defined function to convert a string to proper case (title case).Flexible handling of delimiters and apostrophes to cater for words like "hasn't" and also names like "O'Reilly" and "d'Angelo".Mac and Mc surnames are handled generically, with some rules and exceptions which may need to be extended. Since McIntyre and Mcintyre are both […]
2007-03-14 (first published: 2007-02-14)
1,803 reads
First the SP_TABLECOMPARE was used from the site and all credit must go to the author (greate script). This script is for the creation of an audit trial. It is generic and can be used on any sql database. It deals with legasy naming conventions as well. The script creates the audit tables and triggers. […]
2007-03-13 (first published: 2007-02-15)
1,336 reads
This tool scripts out SQL Server 2000/2005 database objects to individual files in a manner which mimics Microsoft's Visual Studio for Database Professionals [aka, "Data Dude"]. These files can then be placed under proper source management control. An entire database is scripted in one call.Alternatively, it provides a way to simply document the contents of […]
2007-03-12 (first published: 2007-02-15)
2,258 reads
This function works just inverse of COALESCE Function.
2007-03-07 (first published: 2003-06-30)
409 reads
There are many times you have to deploy a common code in all of your SQL Servers. I am sure there might be thousands of way to do this, but here is how I do it and it works great. Good thing is - you can either pass SQL Statement or a SQL script (in […]
2007-03-05 (first published: 2005-05-26)
817 reads
To provide data analysis you may need to perform some basic trend analysis. For example, if you want to identify the percentage of change in the number of orders received from one month to the next. The challenge to providing that on the fly is the change can be either an increase or a decrease, […]
2007-03-02 (first published: 2007-01-25)
6,391 reads
I find myself refacoring an existing database which has some inefficient code, like cursors in stored procedures and triggers ...Wanting to figure out which objects contained this "poor" code, I made myself a little script to list all the objects which contain a search string.Just change the value that @search is set to and run […]
2007-03-01 (first published: 2007-02-07)
1,157 reads
sometime I need to kill an program which does not continue to process data, and i sheduled a job to do that. After lots of times' try, I made it at last.This script add a shedule to the sheduled task list, one minutes later then the current system time. You can change it by edit […]
2007-02-28 (first published: 2004-09-19)
251 reads