Forum Replies Created

Viewing 15 posts - 5,926 through 5,940 (of 8,731 total)

  • RE: PIVOT

    sestell1 (8/25/2014)


    Does anyone actually use the PIVOT operator?

    I find it so limited that I almost always roll my own using GROUP BY and CASE.

    Lots of people come to the forums...

    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: Get First day previous quarter from today's date

    It's easy with some date math.

    You can find common date routines in here to try to understand them:

    http://www.sqlservercentral.com/blogs/lynnpettis/2009/03/25/some-common-date-routines/

    First we get the first day of current quarter:

    SELECT DATEADD(QQ, DATEDIFF(QQ, 0, GETDATE()),0)

    The...

    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: Filtering query using WHERE + CASE

    That's like saying you shouldn't write "colour" and should write "color" just because someone said so.

    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: extracting column values when a part of the column value is known

    Note that you might replace strings you don't want them to be replaced.

    INSERT INTO @test-2(TEST_STRING)

    VALUES

    ('I am a bad Gal')

    ,('I am a good Gal')

    ,('Oh my goodness! There''s no more goodwill')

    ,('He''s...

    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: Results to show up as separate columns

    If you want one column for each benefit, check the following articles about Cross Tabs and Pivots:

    Part 1[/url]

    Part 2[/url]

    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: primary key discussion

    CELKO (8/22/2014)


    What do you use for the PK on lookup tables?

    I use the encoding that is being used. The IDENTITY property (not a column!) is the count of insertion...

    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: Question regarding the difference between two different ways to populate a new table in TSQL

    ChrisM@Work (8/22/2014)


    Cathy DePaolo (8/22/2014)


    I checked the execution plans of each, and they are the same. I am of the opinion that the subquery is not going to improve performance...

    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: pivot 3 columns

    Something as simple as this:

    create table test

    (flsa_status varchar(30),

    bu_dept varchar(30),

    reg_temp varchar(5),

    ftpt char(2),

    value int)

    insert into test values ('Exempt Salaried','Corp','Reg','FT',43);

    insert into test values ('Exempt Salaried','Corp','Reg','PT',10);

    insert into test values ('Exempt Salaried','Corp','Temp','FT',12);

    insert into test values...

    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: pivot 3 columns

    You're correct, but the principle is the same.

    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: Add a total column

    I know you were just having fun, so was I.

    I can't relate to the Phineas and Ferb moment. Should I watch more episodes? 😀

    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: Add a total column

    Are you mocking my signature? :ermm:

    I hope that it can create awareness. :hehe:

    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: Question regarding the difference between two different ways to populate a new table in TSQL

    How did you test the preformance?

    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: Avatar / Photo Issues?

    Koen Verbeeck (8/22/2014)


    Ed Wagner (8/22/2014)


    Thanks, Simon. The only one I can't see is Koen's. Everything else seems to functioning normally.

    I changed my avatar recently.

    I re-uploaded it and now...

    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: The best way to include zero string and null value

    Hey Eirikur,

    You don't even need that function to get the exact same results.

    SELECT

    *

    FROM @TEST T

    WHERE T.TEST_STRING LIKE '%good%';

    To test if a string is not empty or...

    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: pivot 3 columns<!-- 864 -->

    That's when a dynamic query comes handy. I don't have time right now, but this article should help you to get there based on the static sample I posted: http://www.sqlservercentral.com/articles/Crosstab/65048/

    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 - 5,926 through 5,940 (of 8,731 total)