Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL SERVER TO EXCEL

Status
Not open for further replies.

Gusbenz

Technical User
Oct 11, 2015
29
US
I export data from a SQL server to excel. When I export the data the numbers get converted into months and numbers. For example if I convert "11-43". It becomes "Nov-43" in excel. I need to keep the same formatting when I convert to excel.
 
Before you export the data, do you have a (template in) Excel with columns formatted/defined as 'text', 'date', 'numbers', etc?

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
No. It is a program with SQL server that I am exporting from. The excel file automatically opens when I export the data. Is there a way I can format the file after exporting to excel?
 
HI,

Exactly HOW are you exporting this file to Excel?

Is your process actually OPENING a workbook object? Or are you exporting a .csv TEXT file?

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
I have a program that was written for my business. When I hit export in the program it opens an excel file. The excel file populates with the data. However, the formatting is not correct for this field. Is there a way to change the formatting after export.
 
Bell then you program process is flawed, because it must accommodate the rules for the entry of data into Excel, which it does not!

Before entering data into this column containing 11-43, the Number Format for the cells in that column must be changed to TEXT, or the value must be prefixed by an apostrophe as '11-43.

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
What you can do is us the following function to change the data back into a text:
Code:
=TEXT(A1,"MM"&"-"&"YY")
 
I have a program that was written for my business."

I am with Skip. This program needs to be fixed.
zelgar gave you an option to fix your outcome in Excel, but you will need to do that every time you run your program (which you paid for, right? :-( ).

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top