Andrew Poulter


Technical Article

User Defined Function for Padding Numbers

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

You rated this post out of 5. Change rating

2006-03-13 (first published: )

153 reads

Technical Article

Last Day of Month

A script was recently published (Last_Date_Of_Month) that returns the last day of a given month/year combination. I have simplified and improved on that script by eliminating the need to use a WHILE loop. This new script exploits the flexibility of the DATEADD function which allows you to assign negative numbers (thus effectively subtracting a given […]

You rated this post out of 5. Change rating

2004-09-30

147 reads

Blogs

First Time Speaking with a Mask at an Event

By

Over the past couple of months, I have started losing my ability to talk...

A New Word: Apolytus

By

apolytus– n. the moment you realize you are changing as a person, finally outgrowing...

Tired of Tedious SQL Queries? AI Tools Can Automate The Boring Parts

By

If you've ever wrestled with complex SQL code, you know the drill. Hours spent...

Read the latest Blogs

Forums

Do you listen to music when you work?

By Louis Davidson (@drsql)

Comments posted to this topic are about the item Do you listen to music...

Slow update on temp table

By dpaproskijr

I have a job running each night starting at 4:30AM and usually finishing at...

Table Partitioning - remove null range

By goher2000

hi guys,   I have a partitioned table AM_ITM_INSTNC_MSS and I want to  get...

Visit the forum

Question of the Day

Read Only Replica in SQL Server Standard

Our environment runs using SQL Server Standard. We are implementing Availability groups. Our database has been experiencing high read volumes, so I want to let the application read the Synchronized Secondary replica, as I read that HADR does this. Can we implement this?

See possible answers