this script will generate CREATE index statements for all indexes in the database;there are already scripts out there that script constraints for primary keys and unique constraints, which automatically create an index behind the scenes. but what about the other indexes?uncomment two statements in order to filter out primary keys and Unique indexes so you […]
2006-03-17 (first published: 2006-03-07)
30,008 reads
Script used to validate whether the given email address is valide or not.
2006-03-16 (first published: 2004-09-29)
217 reads
SQL Function to calculate number of business seconds between 2 datetime fields. Input Parameters: @startdate - Start Time (datatype DateTime) @enddate - End Time (datatype DateTime) @starthour - Start of Business Day (datatype DateTime) (Format: '1900-01-01 9:00:00') @endhour - End of Business Day (datatype DateTime) (Format: '1900-01-01 17:00:00') @workdays - Business Day string - Use […]
2006-03-15 (first published: 2005-01-17)
245 reads
This version uses the Sieve of Eratosthenes algorithm, which is very fast for moderate upper bounds, but which may be slower than the other versions when the upper bound is very large (because of the overhead of the initial table population)
2006-03-14 (first published: 2003-12-17)
102 reads
This scalar udf takes three parameters @Number INT, @Length INT, @Position CHAR(1) and returns a VARCHAR(50) string which pads @Number with zeros to the specified @Length either to the right or to the left, according to @Position ('L' or 'R').E.g. SELECT dbo.udf_PadNumber(5, 6, 'L') returns '000005' whereas SELECT dbo.udf_PadNumber(5, 6, 'R') returns '500000'. The function […]
2006-03-13 (first published: 2004-08-25)
158 reads
Simple job script to cycle the SQL Log ever 24 hoursThe job is set to disabled as you should review any script that creates a job before enabling it on your server.
2006-03-06 (first published: 2004-10-29)
1,020 reads
Based on Ramesh Kondaparthy's script (Script to Generate DataDictionary for Database, posted 8/5/2005), I made a few format changes and included a few more columns.I modified Ramesh's script so that I could copy the result and paste it into Word as the beginning of a Data Dictionary document. (Hint: Once you've pasted the result into […]
2006-03-01 (first published: 2005-08-12)
520 reads
Probably, many of you know this trick, but I thought it might be useful to people who doesn't know it. This script, when run in query analyzer with text output selected, simply creates property methods code. This example is written for creating property methods for c#. But you can modify it for any language. The […]
2006-02-28 (first published: 2005-04-14)
168 reads
This scipt is inspired by FormatDate - Mimics the VB Format routine for date. But this script work actually only whith a english Server. I improved this by a language independant. I use 2 others functions to retrieve the Long and short month name.
2006-02-27 (first published: 2004-07-23)
205 reads
This script takes a string of up to 8000 characters with a single character delimtier and returns a table with each substring in its own row. A identity column is also returned so you can easily find the n'th item in the list.Script is similar to kmlakov's but doesn't require the item count and adds […]
2006-02-21 (first published: 2005-01-19)
1,259 reads