outofservice
Technical User
Hi,
Here is some Oracle PLsql that needs to be converted to its SQL Server equivalent. I am at a loss as to how to do this!!
Oracle SQL is:
SELECT lpad(n_num+600000, greatest(length(n_num+600000), length(n_num)),0) FROM numbr;
It takes the n_num column from the numbr table and increases the number by the set amount.
eg n_num
00123 + 8 = 00131
00123 + 60 = 00183
00123 + 600 = 00723
00123 + 6000 = 06123
00123 + 60000 = 60123
00123 + 600000 = 600123
But if the number is prefixed by 0's (zero's) it puts them back on, or if the end number is the same length as the original numbers length, with any prefix, it does not put the prefix on. The same for if the number goes above the original length.
Thanks for your help. Lauryn Bradley
SQL Server DBA
Here is some Oracle PLsql that needs to be converted to its SQL Server equivalent. I am at a loss as to how to do this!!
Oracle SQL is:
SELECT lpad(n_num+600000, greatest(length(n_num+600000), length(n_num)),0) FROM numbr;
It takes the n_num column from the numbr table and increases the number by the set amount.
eg n_num
00123 + 8 = 00131
00123 + 60 = 00183
00123 + 600 = 00723
00123 + 6000 = 06123
00123 + 60000 = 60123
00123 + 600000 = 600123
But if the number is prefixed by 0's (zero's) it puts them back on, or if the end number is the same length as the original numbers length, with any prefix, it does not put the prefix on. The same for if the number goes above the original length.
Thanks for your help. Lauryn Bradley
SQL Server DBA