Scripts

Technical Article

Find Nth Max-Min Record - The Efficient Way!

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 […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2005-07-22 (first published: )

1,076 reads

Technical Article

Deleting Sets of Rows in huge table

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 […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2005-07-20 (first published: )

300 reads

Technical Article

Sproc to get First Day of the Month,First Weekday ETC

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

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2005-07-15 (first published: )

234 reads

Technical Article

Drop and Add Foreign Keys

Have you tried using DTS to load a database and those pesky foreign keys mess you up? This is actually two scripts, one to generate the SQL needed to drop all the Foreign Keys in a database and another to Add the Foreign Keys back when you are done. I've thrown in Disabling and Enabling […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(9)

You rated this post out of 5. Change rating

2005-07-13 (first published: )

3,086 reads

Technical Article

Shrink Log file for all Databases

I use this script to shrink the log files for development databases. The intention is keep the log files as small as possible when the database is not in use. By scheduling this script I can control when it happens as oppose to using auto shrink.

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(2)

You rated this post out of 5. Change rating

2005-07-08 (first published: )

2,540 reads

Technical Article

Search All Fields in db for a Specific String

forums question came up where someone needed to search every varchar/char field in the database, and find any table/field that had a specific value (ie ip address, email, servername) we all agree that a monster scan like this is bad, but bad or not, sometimes you need to do it.it returns results that look something […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2005-07-07 (first published: )

281 reads

Technical Article

Import databases using backups v 2

Import database from source server using full and transaction log backups as recorded in msdb. Use it to import one or more databases to your development environment, to test your backups regularly or to move databases to a new server. To move to a new server, take a transaction log backup and put all in […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2005-07-04 (first published: )

241 reads

Blogs

Car Update September 2026

By

Software is hard. While I love our Lucid Gravity, I realize that they are...

Microsoft Tools for Making Data AI-Ready

By

Making Data AI-Ready, Part 2 (This is the second article in a three-part series...

Local Models Using GPUs with Ollama

By

Can you use your GPUs when running a local model under Ollama? You can,...

Read the latest Blogs

Forums

Alamat BCA KCP Metro Tanah Abang Telp:0821°7555°651

By layanan_Bca88

Hub Cs 08217555651 Pusat Grosir Metro Tanah Abang 2 Lt. 7. 10, Jl. K.H....

BCA KCU MENARA BCA Telp/Wa:08218200203

By m4rt1n4

Hub Cs 08218200203 Menara BCA, Grand Indonesia, Jl. M.H. Thamrin No.1 Lt. 28, RT.1/RW.5,...

Alamat BCA KCP Raden Saleh Telp/Wa:08218200233

By R4nt4u

Hub Cs 08218200233 Jl. Raden Saleh Raya No.17A No. 13, 15, RT.1/RW.2, Kenari, Kec....

Visit the forum

Question of the Day

Reserved Words I

Which of these are not reserved words?

See possible answers