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

SQL Data Pipelines: The Ultimate Guide to Streamlining Your Data Flow

By

Want to build a data analytics foundation that transforms raw data into valuable business...

Using SQL Compare in Read-Only Databases

By

Recently a customer asked if SQL Compare and SQL Data Compare can be used...

T-SQL Tuesday #179 Roundup: The Data Detective Toolkit

By

Earlier this month, I hosted the monthly T-SQL Tuesday invitation in which I asked,...

Read the latest Blogs

Forums

Date Type ETL Question

By Coffee_&_SQL

I'm not sure that I'm posting this in the right section, so please mods...

Possible oddity in msdb.dbo.backupset

By richardmgreen1

Hi all   I've written a script to keep track of how long backups...

Operand data type varchar is invalid for sum operator

By yrstruly

I have this view [dbo].[Asset Metrics - Client(Rama -Client-Test)], which makes use of multiple...

Visit the forum

Question of the Day

Data Migration Assistant Sources

In the current (Sep 2024) Data Migration Assistant, what are the possible sources for on-premises SQL Server instances?

See possible answers