+ Reply to Thread
Results 1 to 3 of 3

problem with data in pivot table from sql server

  1. #1
    Registered User
    Join Date
    11-11-2004
    Location
    Czech Republic
    MS-Off Ver
    Excel 2016 for Windows 10
    Posts
    22

    problem with data in pivot table from sql server

    Hi,
    I have problem with pivot table - I need to load column with shifts - on the SQL server I have data A, B, C, 4. In database the column is varchar/string. But the Query in Excel loads the data as Integer. But I didn't found the key, how it is converted. Sometimes is A 1, sometimes 3.
    I tried to convert it in SQL definition with CASE.

    shift=
    (SELECT
    CASE
    WHEN TabPrikazMzdyAZmetky_EXT._shift=1 THEN 'A'
    WHEN TabPrikazMzdyAZmetky_EXT._shift=2 THEN 'B'
    WHEN TabPrikazMzdyAZmetky_EXT._shift=3 THEN 'C'
    WHEN TabPrikazMzdyAZmetky_EXT._shift=4 THEN 'D'
    END)
    It works, but it only convert the wrong values - sometimes 1 - exactly to A, and 3 to C.

    Any idea how to load data from SQL directly as STRING?

    Thank You very much.

    Martin

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,447

    Re: problem with data in pivot table from sql server

    Administrative note
    Please update your profile as necessary to properly reflect the exact version(s) of Excel your question relates to. Members tailor answers based on your Excel version. Your profile does not indicate your version.
    Thanks

  3. #3
    Registered User
    Join Date
    11-11-2004
    Location
    Czech Republic
    MS-Off Ver
    Excel 2016 for Windows 10
    Posts
    22

    Re: problem with data in pivot table from sql server

    Thank You Pepe, added.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel Pivot Table from SQL Server cannot show non-aggregate
    By supremesabre in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-30-2018, 04:45 AM
  2. Replies: 6
    Last Post: 01-24-2017, 06:56 PM
  3. Pivot table problem - how to relate 3 sheets' data into 1 pivot table?
    By GRG Stevan in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-14-2015, 06:12 AM
  4. Using Pivot table data outside of an SQL Server machine
    By moty.98 in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 06-03-2013, 05:32 AM
  5. Refresh Pivot Table SQL Server
    By MatthewOwens in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-23-2009, 09:54 PM
  6. [SOLVED] get SQL Server text data type into Excel pivot table
    By Lee@360Commerce in forum Excel General
    Replies: 0
    Last Post: 08-19-2005, 07:05 PM
  7. [SOLVED] Pivot Table based on SQL Server query
    By Ben Rum in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-31-2005, 07:26 AM

Tags for this Thread

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