Forum Replies Created

Viewing 15 posts - 901 through 915 (of 2,452 total)

  • RE: Pivoting Problem

    silverbullettruck (2/2/2016)


    Can we push the reset button? I think I derailed people by mistake. Here's a smaller set of data and a before and after of the result...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Pivoting Problem

    to pile on with the confusion if I may

    what results required for this set?

    CREATE TABLE #Test (

    RBR VARCHAR(3) NULL,

    Attribute VARCHAR(10) NULL,

    Value VARCHAR(2)

    )

    INSERT INTO #Test VALUES ('ONR','XLOC','ML')

    INSERT INTO #Test VALUES ('ONR','XLOC','MS')

    INSERT...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Pivoting Problem

    just for fun......is the following a correct answer ??

    CREATE TABLE #Test (

    RBR VARCHAR(3) NULL,

    Attribute VARCHAR(10) NULL,

    Value VARCHAR(2)

    )

    INSERT INTO #Test VALUES ('ONR','XLOC','ML')

    INSERT INTO #Test VALUES ('ONR','XLOC','MS')

    INSERT INTO #Test VALUES ('ONR','XLOC','ML')

    INSERT INTO...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Pivoting Problem

    Looks like Jacob bet me to it....was going to ask same question.

    I am also wondering what business requirement you are trying to answer.

    with possibly unlimited attributes each having unlimited values.....what...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Pivoting Problem

    is this "your" table design.....can you make any changes to it?

    going back to your original post...what results are you expecting from such a scenario as the following?

    RBR Attribute Value

    ------- ----------...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Pivoting Problem

    silverbullettruck (2/2/2016)


    Yes, that entry was intentional as well as the other duplication in the results.

    ok...so can I assume as well as duplicates that each LOB/Attribute pair can have 1 to...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Pivoting Problem

    silverbullettruck (2/1/2016)


    ChrisM/ER...Here is the full dataset i am working with and then below that is the what i need the data to look like after it is pivoted.

    have...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Nested Case?

    suggest you give us sample data and expected results.....we will all be on the same page then 🙂

    http://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Pivoting Problem" in "Development - SQL Server 2014"

    Hugo Kornelis (1/31/2016)


    The original post appears to be back, but the reply I had already posted is still missing. And so are the two replies posted later (that I did...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Are the posted questions getting worse?

    Hugo Kornelis (1/31/2016)


    Hmmm, that's strange. I got email notifications about new posts to a topic that I previously contributed to, but when I click the link I get an error...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Pivoting Problem" in "Development - SQL Server 2014"

    Jeff Moden (1/31/2016)


    It is my fault. I was deleting SPAM and hit the wrong thread. I've sent an email to the WebMaster asking if he could undelete it.

    ok...but,...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Are the posted questions getting worse?

    Jeff Moden (1/30/2016)


    Hugo Kornelis (1/30/2016)


    The problem is, as long as there is as much as a single person on the forum who just posts some random code that appears to...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Make Rows to a Column

    yb751 (1/29/2016)


    This is an example on how you can do it using a crosstab.

    DECLARE @myTable TABLE (ID INT, Name VARCHAR(10), Value VARCHAR(20))

    INSERT INTO @myTable

    VALUES

    (1, 'user', 'MYS12345'),

    (2, 'user', 'MYS12346'),

    (3, 'user', 'MYS123435'),

    (4,...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Datetime conversion

    Luis Cazares (1/29/2016)


    J Livingston SQL (1/29/2016)


    Luis Cazares (1/29/2016)


    Maybe this:

    DECLARE @date varchar(10) = '14-Apr'

    SELECT CONVERT(datetime, '01 ' + RIGHT(@date,3) + ' ' + LEFT(@date,2), 6)

    Hi Luis......why not just use this instead??

    SELECT...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

Viewing 15 posts - 901 through 915 (of 2,452 total)