I'm in need of a function to concatenate 2 numbers in SQL Server
eg
getuserid(3,333) = 3333
getuserid(8,5) = 8005
getuserid(2,11) = 2011
It should return the result based on the length of second parameter (like 3rd example)
I tried converting it to string and using case statements I concatenated it. But, I feel that,this can be done mathematically in a more effective manner. Can anyone please suggest a way.?
By the by, the output returned should be a numeric type.!
Looks like this will do it:
select num1 * 1000 + num2
Why do you need a function for this simple math?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With