usp_ToggleDatabases is a simple procedure that will switch the names of two databases.One of the main problems with using sp_renamedb to switch databases is that the procedure will wait until the database is free before the rename can be completed. If the new live database is also in use then there is a likelyhood that […]
2005-08-04 (first published: 2005-07-28)
495 reads
THIS TABLE WILL HODL YOUR TABLENAME AND UP TO THREE KEY COLUMNS FOR CREATING YOUR PRIMARY KEYSTHE OTHER COLUMNS ARE USED IN PROCESSING THE KEY'S AND GENERATING THE ALTER TABLE ASTATEMENTS TOCREATE THE PRIMARY KEYS FOR YOUR DB. THIS TOOL IS HANDY FOR PREPPING FOR A REPLICATION STRATEGY TO HELP YOU QUICKLY INDENTIFY IF YOU […]
2005-08-03 (first published: 2005-08-01)
377 reads
We were experiencing significant issues with Cross Domain Log Shipping, even after getting help from Microsoft. The main reason was that in SQL Server 2000 you cannot access the Log Shipping Wizard from a scripting interface. This set of stored Procedures is all you need to setup a good log shipping framework in your organization […]
2005-08-01 (first published: 2005-07-18)
3,029 reads
If you wish to save the contents of your database as insert statements, this script will generate a text file that has all data formatted as insert statements. This way you can save off the data as a script to send to a client or combine with a create script to rebuild the database on […]
2005-07-29 (first published: 2005-07-18)
872 reads
I use this script to quickly compare databases. In the past, I would generate creation scripts and compare those but that is tedious at best. This script generates a report of the metadata in an easy to read format that includes...- Table and Field Listing with types.- Foreign Key information- Primary Key and Index information- […]
2005-07-28 (first published: 2005-07-18)
587 reads
If you wish to Format Number to 2 decimal without rounding it then, here is the trick.This is also useful when you are dividing 2 numbers and you need answer in 2 digiits only without rounding
2005-07-25 (first published: 2005-06-23)
504 reads
It is quite often that we need to find Nth (5th or 8th or 10th) maximum or minimum number of record from the record set. The solution is different in MS SQL than in Oracle because we have RowNum in Oracle. Some time ago I got the same problem with a massive table of more […]
2005-07-22 (first published: 2005-07-05)
1,061 reads
Script lists 'First day of the week','Last day of the week','Last day of the month' and 'First day of the month'
2005-07-21 (first published: 2005-07-07)
676 reads
There was a problema user was reflecting http://groups.yahoo.com/group/sqlcon/message/1119What I did was following steps1. Divide the count of table into segments for divide2. Then use the even Odd functionality for smooth looping3. Use a simple while loop and SET ROWCOUNT functionality for further deletions across table with checkpoint4. It saved the log swell up and resources […]
2005-07-20 (first published: 2005-07-07)
267 reads
First Day of the Month, First Weekday, Total Days in this Month, Days In First WeeK, Days In Last Week,Total Weekend Days sample output: Given Date:Jul 16 2005 12:00AM First Day of the Month:7/1/2005 First Weekday (sun=1,sat=7):6 Total Days in this Month:31 Days In First Week:2 Days In Last Week:1 Total Weekend Days:10
2005-07-15 (first published: 2005-06-21)
223 reads