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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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: