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

Using Git Prune–#SQLNewBlogger

By

As I’ve been working with SQL Saturday and managing changes to events, I’ve accumulated...

Microsoft Purview new data governance features

By

Starting last week is a rollout of the public preview of a new and...

SQL Database Administration: Not For Everyone (But Maybe It’s for You)

By

Let's get one thing straight: database administration isn't the most glamorous tech job out...

Read the latest Blogs

Forums

Audio Visual Rentals Toronto

By avcanada

From immersive sound systems to dynamic visual displays, Audio Visual Rentals Toronto offers everything...

Do I need a recursive query for this? bill of materials (sort of)

By pietlinden

I am working on a data warehouse project for a bakery. For the most...

Do I need a recursive query for this? bill of materials (sort of)

By pietlinden

I am working on a data warehouse project for a bakery. For the most...

Visit the forum

Question of the Day

Restoring the Resource Database

How can I restore a version of the Resource Database in SQL Server 2022?

See possible answers