Forum Replies Created

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

  • RE: Using the Stuff Function

    Do you know what the stuff function does?

    https://msdn.microsoft.com/en-us/library/ms188043.aspx

    SELECT STUFF ( 'This is a lack of knowledge' , 11 , 7 , 'great' )

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Need help with Pivot multiple columns in a single select

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

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: How can I pivot this rows

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

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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....

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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)...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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