Forum Replies Created

Viewing 11 posts - 1 through 12 (of 12 total)

  • RE: More Unicode

    Correct answer:

    Yes, you can run this code, This returns 97

    Explanation:

    You can run this code. The CHAR variable is converted to NCHAR and the first character's value returned. An...


    The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

  • RE: Pivot rows into columns

    Here is a dynamic version of Alan's answer:

    CREATE TABLE Licenses(

    RegID INT,

    License# ...


    The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

  • RE: EXISTS queries that can't be written any other way

    Here is a related blog by Aaron Bertrand: sqlperformance.com/2012/12/t-sql-queries/left-anti-semi-join


    The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

  • RE: Dynamic Pivot, Passing Temp Table Variables to Dynamic SQL

    Nice article. Although I still prefer Jeff Moden's dynamic crosstab approach:

    DECLARE @sql NVARCHAR(MAX) = ''

    SELECT @sql =

    'SELECT

    TableName' + CHAR(10)

    SELECT @sql = @sql +

    ', AVG(CASE WHEN YEAR(CreatedDate) = ' +...


    The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

  • RE: Spam Spam Bacon and Spam

    Lowell (10/5/2015)


    they added code that insta-deletes anything Celko posts(thank you for that!)

    So that's why I received an email saying:

    A new reply has been added by CELKO to a topic...


    The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

  • RE: Understanding the OVER clause

    Great explanation particularly on the RANGE and ROWS clause. Thanks very much for this.


    The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

  • RE: Join one to many

    Phil Parkin (10/12/2015)


    Nice code, Felix.

    Quick suggestion...

    Not sure how quick it was though; have you been listening to Eirikur?

    Yeah! I've been lurking this forum for quite some time now and decided...


    The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

  • RE: Join one to many

    Quick suggestion: Use dynamic crosstab:

    -- Prepare Sample Data

    CREATE TABLE INCIDENT(

    IDINT PRIMARY KEY,

    [Date]DATE

    );

    CREATE TABLE PEOPLE(

    INC_IDINT FOREIGN KEY REFERENCES INCIDENT(ID),

    PersonIterationINT,

    ComplaintVARCHAR(20)

    );

    INSERT INTO INCIDENT VALUES(1, GETDATE());

    INSERT INTO PEOPLE VALUES (1, 1, 'Head'), (1, 2,...


    The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

  • RE: Whats wrong in this query

    Try to rewrite this join.

    Using such constructions in joins, especially when OR is involved is asking for trouble.

    Try something like this:

    ...

    left join objectA

    on objectA.ID = case

    ...


    The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

  • RE: Wildcard Searches

    Great article! Thank you.


    The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

  • RE: Splitting Strings Based on Patterns

    Genius!


    The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url]

    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs[/url]

Viewing 11 posts - 1 through 12 (of 12 total)