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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 from sql server to excel cannot copy and paste
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

230 Posts

Posted - 10/14/2012 :  13:14:49  Show Profile  Reply with Quote
I have a column in sql server with data type nvarchar(50) and its values are both numbers and alphabets.

My queries are something similar to

select code from table1
where owner = 'abc'

output :


When copy and paste the output in excel, the values that are in numbers like '000032' are just pasted as '32' in excel. Similarly, 00012 as '12' and '00001' as '1'.

I'm not sure if I have to make any change in sql server query or sql server data type to make understand the excel or if it is something related to excel issue.

Flowing Fount of Yak Knowledge

5155 Posts

Posted - 10/14/2012 :  15:04:44  Show Profile  Reply with Quote
This is a case of Excel trying to be helpful and interpreting data that looks like numbers to be numbers. What you can do is select the cells/columns in the Excel sheet and (right-click, select format cells and) select Category as Text under the number tab, BEFORE pasting the data.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.85 seconds. Powered By: Snitz Forums 2000