Forum Replies Created

Viewing 15 posts - 256 through 270 (of 3,957 total)

  • RE: Extract Value from XML Column

    DECLARE @XML TABLE

    (

    XML1 XML

    );

    INSERT INTO @XML

    SELECT CAST(

    '<ActivityDescription>

    <text value="PCN was initiated for Policy ^1 on 12/07/2015. Cancellation Date is: 12/23/2015. Amount needed...

  • RE: The Worst Comments

    MLK44 (3/12/2015)


    .

    +1. What's worse: bad comments or no comments?

  • RE: The Worst Comments

    Absolutely the worst comment I have ever seen in code, and it was all over the place at one previous shop I worked at:

    -- Process data

    It wasn't in SQL though....

  • RE: Compare dates between 2 different rows and columns

    Assuming that you've fixed your data anomalies by now, you might want to take a look at this article:

    Self-maintaining, Contiguous Effective Dates in Temporal Tables[/url]

    It gives you a way to...

  • RE: Stripping First & Last Name from Email Address

    Just for fun, here's a way to do it using the pattern-based string splitter described in my signature links:

    SELECT FirstName = MAX(CASE ItemNumber WHEN 1 THEN Item...

  • RE: Extract Value from XML Column

    Here it is extracted as a character string:

    DECLARE @XML XML =

    '<ActivityDescription>

    <text value="PCN was initiated for Policy ^1 on 12/07/2015. Cancellation Date is: 12/23/2015. Amount needed to rescind PCN...

  • RE: Find overlapping date ranges for more than 2 ranges

    coalesceuk (3/11/2015)


    dwain.c, the cross apply does remove a lot of the table scans and works in 2005. I find it harder to understand/read what a cross apply is doing just...

  • RE: SQL

    You can get the months you need using a Tally or Calendar table.

    declare @open_period_name varchar (20)

    set @open_period_name = '201501 May 2014';

    declare @GroupSize int

    set @GroupSize = 3;

    WITH Tally (n) AS

    (

    ...

  • RE: Second Friday of every month

    Alan.B (3/11/2015)


    dwain.c (3/11/2015)


    This is quite easy to do if you already have a calendar table that stores that information:

    Calendar Tables in T-SQL[/url]

    The GenerateCalendar FUNCTION included in that article shows how...

  • RE: Second Friday of every month

    This is quite easy to do if you already have a calendar table that stores that information:

    Calendar Tables in T-SQL[/url]

    The GenerateCalendar FUNCTION included in that article shows how it can...

  • RE: Logic in a default constraint?

    Why can't you do this?

    CREATE TABLE #Temp

    (

    ID INT...

  • RE: Find overlapping date ranges for more than 2 ranges

    You can probably save yourself a couple of scans by changing CTE c1 as follows:

    with c1 as --Get all the events in a row

    (

    select --Start Date of Employees on Projects

    p.ProjectId

    ,t

    ,ProjectIncrement

    ,MeetingIncrement

    from...

  • RE: Find overlapping date ranges for more than 2 ranges

    coalesceuk (3/10/2015)


    Many thanks for your responses - I've got some things to try now!

    dwain.c, I probably didn't explain it too well, and my attempt to anonymise/simplify what I'm really trying...

  • RE: Tally OH! An Improved SQL 8K “CSV Splitter” Function

    Erikur,

    Thanks for continuing to play around with it. I did too and I am getting some inconsistent results with DelimitedSplit8K using my original approach. I believe this is...

  • RE: Tally OH! An Improved SQL 8K “CSV Splitter” Function

    Eirikur Eiriksson (3/10/2015)


    dwain.c (3/10/2015)


    I guess the real point of my post was not to offer competition to DelimitedSplit8K (or any of its variants). Rather to see if anybody has ever...

Viewing 15 posts - 256 through 270 (of 3,957 total)