Forum Replies Created

Viewing 15 posts - 3,841 through 3,855 (of 8,731 total)

  • RE: Need help with Pivot multiple columns in a single select

    Please, check your sample data. It won't run.

  • RE: Are the posted questions getting worse?

    Jack Corbett (11/12/2015)


    Sean Lange (11/12/2015)


    Brandie Tarvin (11/12/2015)


    Sean Lange (11/12/2015)


    djj (11/12/2015)


    Grant Fritchey (11/12/2015)


    Still, could be fun. Build out a nested CTE inside a function, use the same table aliases...

  • RE: Allways 3 rows...

    I'm guessing that it would be better to correct this from the start instead of adding work to a result that you already calculated.

  • RE: How can I pivot this rows

    Jason-299789 (11/12/2015)


    The best way would be to use the CROSS TAB method, mentioned in this article : http://www.sqlservercentral.com/articles/T-SQL/63681/

    Will the number of columns be limited to 3 or will it depend...

  • RE: Need help with Pivot multiple columns in a single select

    Use CROSS TABS[/url] with the MAX() function, probably with a row number to avoid losing rows.

    I'm really not sure what's your expected output based on that sample data and explanation.

  • RE: How can I pivot this rows

    Use CROSS TABS[/url] with the MAX() function.

  • RE: 4 Queries Required Very Urgent

    The syntax errors would be the least of your problems if you're not expected to run your code against a database. You're missing half of the logic for your queries....

  • RE: Key Value Pair Table

    yb751 (11/11/2015)


    Well I just finished talking with our Dev team and I realized that the attributes do not need to be updated individually. Also any searches would be offloaded...

  • RE: Rewrite using CTE

    Sean Lange (11/11/2015)


    rxm119528 (11/11/2015)


    Apologies for the missing loop. Thanks for the different approaches. I just wanted to learn the other ways we can append those sequence of numbers with out...

  • RE: sysobjects id field value limit reached (INT)

    I'm not sure there's something documenting either that the id is reusable nor it's completely unique. It might not be an identity either if that's what you were expecting.

    You shouldn't...

  • RE: Rewrite using CTE

    I see that Sean got the simpler route by defining hard coded values.

    This should allow the results to grow in an easier way if needed.

    DECLARE @VARABLE VARCHAR(10) = 'AB.DEF';

    WITH

    E(n)...

  • RE: Key Value Pair Table

    Kristen-173977 (11/11/2015)


    yb751 (11/11/2015)


    It doesn't make sense to create a 137 column table with tons of empty fields

    It would to me if you were OUTER JOIN'ing the KeyValue table 137 times...

  • RE: Key Value Pair Table

    You might not be able to get rid of that table completely, but with some analysis, you could create several tables once you identify common attributes to define entities correctly.

  • RE: Delete using MERGE

    EXISTS should be better than a MERGE which might need an expensive sort operation.

    How much are you deleting and how much are you keeping in the table? Maybe that would...

  • RE: SQL Column update with comparison with another table

    Probably this will return the expected rows?

    Select dbo.R_ResrvStock.Vin,

    R_Txt_Temp.Vinnumber,

    R_Txt_Temp.Model_Code

    from dbo.R_ResrvStock

    inner join R_Txt_Temp on Right (RTRIM(dbo.R_ResrvStock.Vin),LEN(R_Txt_Temp.VinNumber))=R_Txt_Temp.VinNumber

    Without DDL and Sample data as insert...

Viewing 15 posts - 3,841 through 3,855 (of 8,731 total)