Help - cross tab / pivot - updating data

  • Hi,

    I have data stored in a couple of columns in my database. For example - item_type and item_value. First, I need to convert this into a row by row format for display where each item_type would display with its corresponding item_value in a grid control.

    My users have the ability to make changes to any of these values from the user interface. I then need the ability to update the table with the modified values.

    Will using a cross tab query help with the update? I can manage to get the select to work and display data in the right format but its the update that I am challenged with.

    Thanks!

  • Yes it will.. IF u could post sample data in a readily consumable foramt, we can work right away in providing a code for you..

  • ColdCoffee (3/3/2011)


    Yes it will.. IF u could post sample data in a readily consumable foramt, we can work right away in providing a code for you..

    And for help in getting your data that way, please click on the first link in my signature below.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • We are using the below table to display data in a GridView:

    -- Create a Demo Database

    create database crosstab_demo

    GO

    use crosstab_demo

    GO

    -- Create a demo Table

    create table demo1

    (

    field_id int IDENTITY(10000,1) CONSTRAINT [PK_field] PRIMARY KEY,

    rownum int not null,

    value varchar(50)

    )

    GO

    -- Insert values into the table

    insert into demo1 values(1,'A')

    insert into demo1 values(1,'B')

    insert into demo1 values(1,'C')

    insert into demo1 values(1,'D')

    insert into demo1 values(2,'AA')

    insert into demo1 values(2,'BB')

    insert into demo1 values(2,'CC')

    insert into demo1 values(2,'DD')

    GO

    select * from demo1

    GO

    Now, Grid would display the grid based on rownum.

    For the above stated table; grid would display two rows 1 & 2.

    The rest of the data would be placed in the corresponding rownum

    We are supporting InPlace edit option in the GridView.

    The problem is we wanted to have a mechanism to automatically update or insert data from the grid itself.

    Could you please provide us with some technical assistance to achieve this with minimum effort involved?

    Thanks

  • @pverma,

    if you start a new thread with the very same issue as posted in an earlier thread, you could at least mention it, so people trying to help will know what has been discussed so far.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply