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