I'm new to SQL Query Analyzer, but not SQL itself. I've looked in the help
files for the proper way to format a value in the output of my query, but
can't find it. The keyword FORMAT is acceptable, but I can't get the rest of
the syntax.
My query is like this:
Select count(*), sum(average balances) as average balances format="$#,##0"
from whatever
group by ...
Where does the format syntax belong? Thanks for the help.There's no FORMAT function in SQL Server. The reason FORMAT is a key word is because it is used on
the BACKUP command. I strongly suggest you do formatting in the client application. Let SQL Server
return data and have the client app present the data.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Mark1" <Mark1@.discussions.microsoft.com> wrote in message
news:EF22A6CA-6210-4BA2-98F1-C5B643E71F85@.microsoft.com...
> I'm new to SQL Query Analyzer, but not SQL itself. I've looked in the help
> files for the proper way to format a value in the output of my query, but
> can't find it. The keyword FORMAT is acceptable, but I can't get the rest of
> the syntax.
> My query is like this:
> Select count(*), sum(average balances) as average balances format="$#,##0"
> from whatever
> group by ...
> Where does the format syntax belong? Thanks for the help.|||Do you know of any good reference books that I can purchase to help me answer
questions like this?
"Tibor Karaszi" wrote:
> There's no FORMAT function in SQL Server. The reason FORMAT is a key word is because it is used on
> the BACKUP command. I strongly suggest you do formatting in the client application. Let SQL Server
> return data and have the client app present the data.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Mark1" <Mark1@.discussions.microsoft.com> wrote in message
> news:EF22A6CA-6210-4BA2-98F1-C5B643E71F85@.microsoft.com...
> > I'm new to SQL Query Analyzer, but not SQL itself. I've looked in the help
> > files for the proper way to format a value in the output of my query, but
> > can't find it. The keyword FORMAT is acceptable, but I can't get the rest of
> > the syntax.
> >
> > My query is like this:
> > Select count(*), sum(average balances) as average balances format="$#,##0"
> > from whatever
> > group by ...
> >
> > Where does the format syntax belong? Thanks for the help.
>|||Hi,
SQL Server Books online will be a veruy good resource to veryfy syntax.
Thanks
Hari
SQL Server MVP
"Mark1" <Mark1@.discussions.microsoft.com> wrote in message
news:E4F30BDC-376F-4EF6-9532-6812070683FE@.microsoft.com...
> Do you know of any good reference books that I can purchase to help me
> answer
> questions like this?
> "Tibor Karaszi" wrote:
>> There's no FORMAT function in SQL Server. The reason FORMAT is a key word
>> is because it is used on
>> the BACKUP command. I strongly suggest you do formatting in the client
>> application. Let SQL Server
>> return data and have the client app present the data.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>> Blog: http://solidqualitylearning.com/blogs/tibor/
>>
>> "Mark1" <Mark1@.discussions.microsoft.com> wrote in message
>> news:EF22A6CA-6210-4BA2-98F1-C5B643E71F85@.microsoft.com...
>> > I'm new to SQL Query Analyzer, but not SQL itself. I've looked in the
>> > help
>> > files for the proper way to format a value in the output of my query,
>> > but
>> > can't find it. The keyword FORMAT is acceptable, but I can't get the
>> > rest of
>> > the syntax.
>> >
>> > My query is like this:
>> > Select count(*), sum(average balances) as average balances
>> > format="$#,##0"
>> > from whatever
>> > group by ...
>> >
>> > Where does the format syntax belong? Thanks for the help.
>>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment