+ Reply to Thread
Results 1 to 3 of 3

formatting column from stored procedure

  1. #1
    Registered User
    Join Date
    09-26-2012
    Location
    San Diego California
    MS-Off Ver
    Excel 2010
    Posts
    10

    formatting column from stored procedure

    I'm insert data from a sql server table and I lose all the formatting in the excel file.
    My sales_date and volume both display as general. I need them to display as a date format and a number format.
    They are both character format.


    INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0',
    'Excel 12.0;Database=C:\company-info.xlsx;HDR=YES',
    'SELECT Company, Pub, States, Years, Sales_Date, Container, Volume FROM [Data$]')
    SELECT Company, Pub, States, Years, Sales_Date, Container, Volume from TempFinal


    Any ideas?

    Thank you,

    Slash

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: formatting column from stored procedure

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    09-26-2012
    Location
    San Diego California
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: formatting column from stored procedure

    FDibbins, sorry about that.
    This code actually resides in a sql stored procedure.
    It inserts records from sql server to excel but the formatting in the excel column changes to General.
    I need the columns to stay as a date and number format for the Sales_date and volume fields.



    Please Login or Register  to view this content.
    Thank you,

    Slash

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1