April 15, 2010 at 2:20 am
To format $50000 to $50,000. I use a below query:
"SELECT PARSENAME(Convert(varchar,Convert(money,50000),1),2)"
way faster this way ? Pls, help me. Thanks.
April 15, 2010 at 2:52 am
What reason are you doing it for? Personally, I would always do this sort of thing at the front-end, rather than the DB.
April 15, 2010 at 3:10 am
I want to select data to out to file. So I do that.
April 15, 2010 at 3:18 am
Is the file to be loaded later by another application?
If so, I stick with my original assessment - do it in the presentation layer. C#, VB.Net, Java etc, are all going to be much more efficient at this and will allow for regional differences between clients.
If the file is output straight for printing - well, I think the only way to achieve what you're after is what you've already done.
SELECT CONVERT(VARCHAR(15), CONVERT(MONEY, 50000), 1)
April 15, 2010 at 3:39 am
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply