Andrew Poulter

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

2006-03-13 (first published: )

127 reads

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

2004-09-30

143 reads

Blogs

How Many Bytes Per Character in SQL Server: a Completely Complete Guide

By

A Completely Complete Guide to how many bytes are used to represent characters in...

Power BI Monthly Digest – November 2019

By

In this month’s Power BI Digest Manuel Quintana [Blog | Twitter] and Mitchell Pearson...

Data Masker Reads Column Classificiations

By

One of the newer features in Data Masker for SQL Server is the ability...

Read the latest Blogs

Forums

Numeric and Decimal

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Numeric and Decimal, which is...

VM and SQL core license

By sqlfriend

I am using SQL server 2017 standand edition. We installed on a virtual machine....

look for the most efficient method

By samirca007

Hello everyone , Who can explain to me please the difference between these two...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers

Question of the Day

The CTE Insert

See possible answers