Get the last date of the month for the given date. Algorithm is:1. Transform given date in “first day of the month” 2. Add a month to result 3. Subtract a day from second result
2007-02-27 (first published: 2004-09-30)
216 reads
This procedure is intended for single column primary key relationships.First we will create two table functions. The first finds a list of all tables with their primary key columns. The second finds all existing foreign key relationships with their table and column names. Finally we find all tables with primary key column names that do […]
2007-02-26 (first published: 2006-11-17)
929 reads
I wrote this to calculate the median on a record set. All you need to pass is the table name and column name. If you would like to filter the record set, create a view that displays the correct record.The limitation of not being able to pass arrays to Stored procedure or functions was the […]
2007-02-23 (first published: 2006-10-30)
651 reads
This script changes the physical, logical and file names of a database. It stores the current database until the next time the script is run, and creates a dummy database for the next update. The intent was to have minimal downtime even though the load (import, snapshot, etc.) may take a long time. Three copies […]
2007-02-22 (first published: 2006-10-17)
620 reads
The below command will rebuild all indexes on a database.We need to run the below command in the context of each database that is of interest.
2007-02-21 (first published: 2006-10-23)
1,217 reads
Revise note: 1. reformat the result into HTML page.2. added script to find sql server service account, sqlserver agent account.3. added script to find sql server authentication mode.4. added script to find sql server startup parameters5. added table of contents and hyperlinks.6. add DOS batch script to run the script on all servers. TRY […]
2007-02-20 (first published: 2006-11-10)
1,428 reads
Useful for Idera SQLSafe backups. Great software but the GUI and maintenance plan generation are a little quirky. You can easily modify this for Full, Log, Encryption, etc. - Example:EXEC usp_SS_FullBackup @dbsvrname='YOURSERVERNAME',@dbname='Northwind',@path='C:\Northwind_Full_',@description='Full Backups for Northwind'
2007-02-19 (first published: 2005-10-10)
476 reads
This function was originally contributed by another visitor and I corrected the logic to return the max position of the character if occurrence is greater than the max.I hope everyone finds it useful.
2007-02-16 (first published: 2006-09-03)
126 reads
As we all know, BINARY_CHECKSUM ignores columns of data type IMAGE.This code is 100% compatible with MS original. That is, the result is identical.You can use it "as is", or you can use it to see that MS function does not produce that unique values one could expect.
2007-02-15 (first published: 2006-08-24)
183 reads
Reviewers: Please disapprove this change, thanks Sorry people, I had deleted this script due to red-gate copyright issue, prior to having the copyright confusion cleared up. I will repost if reqd.
2007-02-15 (first published: 2005-09-21)
189 reads