Q

'Format' in SQL Server

I am trying to build an application, which will work on MS Access and SQL Server. I have some queries written by

someone using the Visual Basic "FORMAT" function. I didn't find anything that will be compatible with "Format" in SQL Server. "Cast/Convert" can't solve this issue.

Sample Statements:

 Select Format(Amt, "###,##.##") as Amount from Table A Select "Balance: " & Format(Amt, "###,##.##") as Amount from Table A
Any advice other than to change the current statements?

You are trying to do 2 diametrically opposite things. The format commands are for data display. SQL Server is a storage engine and does absolutely nothing with formatting nor does it have any capability to format for an application. Formatting is done in SQL Server at the application side and does not involve the database engine. There are no equivalents or translations for that kind of thing.

 

For More Information

This was first published in January 2004

Dig deeper on Storage Networks

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchSDN

SearchEnterpriseWAN

SearchUnifiedCommunications

SearchMobileComputing

SearchDataCenter

SearchITChannel

Close