Showing posts with label cant. Show all posts
Showing posts with label cant. Show all posts

Wednesday, March 28, 2012

question regarding putting commas in between a no

How do i put commas so 1234567

comes out as 1,234,567

i know how to put $ in front but i cant figure out how to put commas in the middle of a no. Can anybody help?

i am new at all of this. Sad

SQL Server is not very fast at string manipulation. You're better off doing that in your managed code (i.e. your data access layer, or, preferably, in your UI layer).|||

I agree with robert about formating the ouput in the UI layer. But if you insist, then see function "convert" in BOL.

selectreverse(stuff(reverse(convert(char(25),cast(1234567 asmoney), 1)), 1, 3,''))

AMB

|||

If you are attempting to format currency, try this:


Code Snippet


SELECT ( '$' + convert( varchar(25), cast( 1234567 AS money ), 1 ))


--
$1,234,567.00

Saturday, February 25, 2012

Question on data optimizations

The database maintenance plan wizards present the ability to do either
data/index page reorgs or update statistics.
Is there any reason you can't do both?
Is it because an update of the statistics is automatically done on a
reorg?
Thanks in advance.
Gerry
Hi

> Is it because an update of the statistics is automatically done on a
> reorg?
When SQL Server rebuild indexes ,statistics ares automatically to be
updated
"DataPro" <datapro01@.yahoo.com> wrote in message
news:1164806696.954151.173330@.l39g2000cwd.googlegr oups.com...
> The database maintenance plan wizards present the ability to do either
> data/index page reorgs or update statistics.
> Is there any reason you can't do both?
> Is it because an update of the statistics is automatically done on a
> reorg?
> Thanks in advance.
> Gerry
>
|||DataPro wrote:
> The database maintenance plan wizards present the ability to do either
> data/index page reorgs or update statistics.
> Is there any reason you can't do both?
> Is it because an update of the statistics is automatically done on a
> reorg?
> Thanks in advance.
> Gerry
>
Reindexing will update the statistics...
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||Hello,
You are correct; Statistics will be updated as part of reindex.
Thanks
Hari
"DataPro" <datapro01@.yahoo.com> wrote in message
news:1164806696.954151.173330@.l39g2000cwd.googlegr oups.com...
> The database maintenance plan wizards present the ability to do either
> data/index page reorgs or update statistics.
> Is there any reason you can't do both?
> Is it because an update of the statistics is automatically done on a
> reorg?
> Thanks in advance.
> Gerry
>
|||Thanks much to all.