Monday, March 26, 2012

Need function for padding

Hi

I am using Format function in my query when I was using access tables.

Now I have imported my tables in Sql server and linked through odbc. Now in my query it throws message for "Format" function. I tried for Replicate function but still not able to get this problem.

Same case for Date and chr.you need to use convert or cast, not format.|||it sounds like you are doing SQL Passthrough in jet against sql server, and now you need to use SQL Server syntax instead of jet/access sql.'

cheers|||Originally posted by eisoffind
Hi

I am using Format function in my query when I was using access tables.

Now I have imported my tables in Sql server and linked through odbc. Now in my query it throws message for "Format" function. I tried for Replicate function but still not able to get this problem.

Same case for Date and chr.

If i understand your question correctly, you want to be able to pad the left of a number with another value. For example '555' --> '000555'

Attached are two SQL2K UDFs to lpad and rpad.sql

No comments:

Post a Comment