Generate a 6 digit random number in SQL server

I am switching from Access to SQL server and having some problems with changeing some of the syntax and functions.  I need to return a random 6 digit integer.  

This is what the old sql statment was (Access):
     select format(rnd*1000000,'000000')
 
This is what I what I have come up with (SQL Server):

select right('000000' + rand()*1000000,6)

Unfortunately i still do not get the leading zeros when applicable and sometimes i get a number with a trailing decimal point.  
The only acceptable format for the number is "123456" or "001234" etc. and it must be random.
Any help would be greatly appreciated.  
sigkappuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeff CertainCommented:
select right('000000' + CAST(rand()*1000000 AS VARCHAR(6)),6)
sigkappuAuthor Commented:
Chaosian, I get the following error when there is less than 6 digits (ie when there should be a leading zero) using your suggestion.

Arithmetic overflow error for type varchar, value = 52029.653939.
Jeff CertainCommented:
This works (tested repeatedly with rand*100000 to try to force the error)...
 select right('000000' + CAST(CAST(rand()*1000000 AS INT) AS VARCHAR(6)),6)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sigkappuAuthor Commented:
Looks like it is working great.  I am now getting the leading zero's.  Thanks for the quick help.
Jeff CertainCommented:
No prob. Glad I could be of assistance...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.