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: )

156 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

149 reads

Blogs

Saving Emergency Space on my Laptop

By

With my new laptop, one of the things I realized I’d forgotten to do...

T-SQL Tuesday #178–A Recent Technical Problem

By

This month we have a good invitation from Deepthi Goguri, where she asks us...

WordPress.com and Developers: Roadmap Update

By

Where we've been and where we're going.

Read the latest Blogs

Forums

GIT Configuration and Automated Release for Azure Data Factory

By Sucharita Das

Comments posted to this topic are about the item GIT Configuration and Automated Release...

How to Add a New Shared Disk to a WSFC as a SQL Resource

By muhkam

Comments posted to this topic are about the item How to Add a New...

backups failure

By mtz676

Hello All, We have a domain account running sqlserver service.this account has r/w access...

Visit the forum

Question of the Day

Setting Emergency State

Which server role(s) can set a database to the Emergency State?

See possible answers