Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 PASTE SQL RESULTS INTO EXCEL - funny results

Author  Topic 

FRANKMANIC
Starting Member

10 Posts

Posted - 2008-01-30 : 20:58:14
Hi, when I copy and paste results from query analyzer into Excel it appears that values with zeroes at the end loose the zeroes. Example, if I copy and paste V128.0 into an Excel cell it comes out as V128 or if I copy 178.70 it displays as 178.7 - any ideas? I'm using SQL Enterprise Manager for 2000.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-01-30 : 21:01:26
that is just excel formatting. Just format the cell to 2 decimal places. It has nothing to do with SQL Server


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

FRANKMANIC
Starting Member

10 Posts

Posted - 2008-01-30 : 21:06:46
Hi, Itired the cell formatting but for other values that are 123.5 I end up with 123.50 which is incorrect. these are medical diagnosis codes so the values have to be correct. Is there a cast or convert function that can be applied to a query to get a text output or something?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-01-30 : 21:32:05
format the cell as TEXT first before pasting


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Hommer
Aged Yak Warrior

808 Posts

Posted - 2008-01-31 : 09:29:41
Rule of thumbs I usually tell my customers are:

If you want to preserve every thing, you have to paste it as an image.

If you want that also to be editable, then paste it as plain text.

Excel has its own little brain that will format each column of data on its own best guesstimation.
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2008-01-31 : 09:56:44
did it work ???
if not tell me , i'll tell you a lengthy yet a sure way of doing it

@khtan,I dont know why but it doesn't work that ways ... have you tried what you jst said ?
Go to Top of Page

FRANKMANIC
Starting Member

10 Posts

Posted - 2008-01-31 : 19:50:09
Hi, changing the Excel cells format to TEXT before pasting worked, thanks for all the help!!
Go to Top of Page
   

- Advertisement -