Results 1 to 8 of 8

Thread: [RESOLVED] Tough SQL (like a cross table) -- SQL Server 2008R2

Threaded View

  1. #1

    Thread Starter
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Resolved [RESOLVED] Tough SQL (like a cross table) -- SQL Server 2008R2

    Hi guys

    I using SQL Server 2008R2 and need to convert a vertical table (Key-Values pairs) into a standard looking SQL Server table.....

    The data comes into the db like this

    ReportDumpId Int Indentity
    ReportId Int
    KeyName NVARCHAR(2000)
    KevyValue NVARCHAR(2000)
    KeyType NVARCHAR(255)


    and a sample of the data:

    ReportDumpId ReportId ItemId KeyName KeyValue KeyType
    756 49415 2237099 referencenumber 2237099 notype
    757 49415 2237099 referencenumberusrprefix USR2237099 notype
    758 49415 2237099 category Academic (professor, student, researcher) notype
    759 49415 2237099 attendeerecordurl https://www.eiseverywhere.com/ereg/r...QOt757xQ%3D%3D attendee
    760 49415 2237099 registered 2011-07-19 notype
    761 49415 2237099 registereddateandtime 2011-07-19 12:20:56 notype
    762 49415 2237099 registeredby attendee notype
    763 49415 2237099 registrationstatus Confirmed notype
    764 49415 2237099 approvalstatus Approved notype
    765 49415 2237099 modified 2011-07-19 notype


    What I ultimatlely need is something that looks like this:
    ItemId referencenumber referencenumberusrprefix and so on....
    2237099 2237099 USR2237099


    Any one got any ideas?

    I was thinking of a cross tabl but can't seem to get my head around it.
    Last edited by GaryMazzone; Sep 19th, 2011 at 09:55 AM. Reason: Fix spelling in title
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

Posting Permissions

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



Click Here to Expand Forum to Full Width