Clients asked me to show a more detailed and longer text which doesn't have to be edited. So I came up with the following solution/function.This function returns a varchar time value with a description containing how many days, hours and minutes. For example 100.25 returns :'100:15( 4 Days, 4 Hours, 15 Minutes )'.I hope somebody […]
2007-07-04 (first published: 2006-10-03)
109 reads
This script will give you the facility to search for Particular Data in the Database, To know where exactly that data store(Table Name and Field Information)You Have to Just chage the Name of the Database and the Search String....
2006-09-29 (first published: 2006-09-13)
621 reads
Stored procedure to return the list of columns of the primary key for a table. The name of the column for the result set is the name of the primary key for the table.
2006-09-14 (first published: 2006-09-07)
667 reads
Often the RAND() function is predictable based on the seed. This stored procedure generates a pretty good random integer because the seed itself is quite unpredictable. You can’t put this in a UDF since it is indeterminate due to the RAND and GETDATE() functions used.
2006-09-15 (first published: 2006-09-06)
593 reads
This procedure will give the list of columns included in the primary key for a given table of given database on given server.For. e.g.Get_PrimaryKey 'vrs-118','Demo_StDB','IMAGEREPOSITORY'
2007-02-14 (first published: 2006-08-25)
936 reads
This script will create two views and select the data from the TableReferences view. This view will give list of all the foreignkeys of the selected database with its constraint name, the table name and column name(s) on which the constraint is created and the referencing table name and column name(s).
2006-09-25 (first published: 2006-08-25)
589 reads
to get information about tables+columns+primarykeys+foreignkeys+identity, i firstly used SQL server built-in INFORMATION_SCHEMA.xxx. however, my company have various DBAs and each of them owns objects. when using INFORMATION_SCHEMA.xxx, it retrieves data based on current login (version 2005 resolves this schema v.s. object owner problem already... yeah) , which bring me a great trouble. if you want […]
2006-08-30 (first published: 2006-07-25)
546 reads
This is an example to overcome short comings when using BCP to create a 'proper' CSV file. The view vw_Customers_RAW is used in order to provide a method of creating the column heading row and to enclose columns with embedded comma with double quotes, which are not options in BCP. There are more generic methods […]
2006-07-03 (first published: 2006-06-29)
2,879 reads
Here is a MIME64 encoder function written entirely in T-SQL!© 2006 Peter Larsson, Developer Workshop, all rights reservedAs long as the copyright notice is visible within the function declarationand you include a note in the documentation of your system that thesefunctions are written by me, you may use these functions for free of charge.If you […]
2006-11-09 (first published: 2006-06-15)
996 reads
Specifically, I needed to parse a zip code (5-digit) from a client comments fields where the number was in different positions such as "Customer 999999999 should be at zip code 99999" and "99999 zipcode" and "should be zip code 99999 phone 9999999999". My stored procedure first filters on a [Comments] field string that contains variations […]
2006-11-08 (first published: 2006-06-13)
491 reads