Ask the Expert

'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?

    Requires Free Membership to View

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

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.