I use the power function to accomplish this task.
SELECT RIGHT(power(10,@TotalLength) + @myInt,@TotalLength)
I did use
SELECT RIGHT(Convert(varchar,(power(10,@TotalLength) + @myInt)),@TotalLength)
but found that I could eliminate the convert function from the statement.
Thanks
Todd P Payne