Forum Replies Created

Viewing 15 posts - 3,496 through 3,510 (of 3,957 total)

  • RE: SQL Query

    I believe your query will run as follows:

    select s.stud_code, s.given_name,s.surname,s.year_grp,form_cls,s.dol

    from Students s

    inner join

    (select stud_code, x=count(*)

    from Students as c

    where dol between @StartDate and @EndDate

    and cmpy_code='01'

    group by stud_code

    having count(*)...

  • RE: SQL Query

    I think there's more issues here than just the syntax error:

    1. DOL is a datetime (presumably), so why the test on DOL <= '5'?

    2. Where is the ON following the...

  • RE: Converting first letter of every word to uppercase

    Jeff Moden (5/25/2012)


    dwain.c (5/15/2012)


    Jeff Moden (5/15/2012)


    BWAAA-HAAA!!! Thanks for having a good sense of humor, Dwain! You've made my day! 🙂

    Shifting gears back to the subject at hand... there's...

  • RE: Shred Me This

    You have no idea what a time-saver you just posted for me. I needed to search out that very same gaps and islands article for something else I'm working...

  • RE: Shred Me This

    R.P.Rozema (5/25/2012)


    The difference is that Mark used a cross-tab, where you turned to a pivot. Cross tabs are most of the times faster than pivots because it lacks one operation...

  • RE: Shred Me This

    Yet another method that works but is ugly and probably not recommended. I like my previous one better.

    SELECT @xml1 = (SELECT * FROM @t FOR XML PATH(''))

    -- Add in...

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

    Jeff Moden (5/24/2012)


    dwain.c (5/24/2012)


    Jeff - I've been a fan of this splitter for a long time even though I've been a slow adopter, 🙂 recommending it highly around my office...

  • RE: Hierarchy Structure SQL Query

    Jeff Moden (5/24/2012)


    dwain.c (5/24/2012)


    ...so what makes you think I could do so here?

    Not sure. You DO have a love for rCTEs and I'm thinking that you'll pull a rabbit...

  • RE: Hierarchy Structure SQL Query

    Jeff Moden (5/24/2012)


    dwain.c (5/24/2012)


    Jeff Moden (10/24/2010)


    For the simple task of sorting in the correct order, we'll use the "Hierarchical Path" method. To build it, we'll use a "Recursive CTE"....

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

    Jeff - I've been a fan of this splitter for a long time even though I've been a slow adopter, 🙂 recommending it highly around my office at any opportunity.

    I...

  • RE: Shred Me This

    dwain.c (5/24/2012)


    This suggestion gives me an interesting idea which I am clueless how to act on (haven't read the link yet but I will).

    Would it be possible to store each...

  • RE: Shred Me This

    Mark-101232 (5/24/2012)


    R.P.Rozema (5/24/2012)


    Of course the xml should be improved on for any practical implementation, but still this challenged me. Since this is hypothetical already and on top of that Mark...

  • RE: Shred Me This

    Mark-101232 (5/24/2012)


    Try this, I can't see a simpler way with the XML as is.

    WITH CTE AS (

    SELECT row.value('local-name(.)', 'VARCHAR(50)') AS name

    ,row.value('text()[1]', 'VARCHAR(50)') AS val

    ...

  • RE: find whether a upper case letter is there in a given string

    Another option:

    DECLARE @t TABLE (Names VARCHAR(20))

    INSERT INTO @t

    SELECT 'sarat' UNION ALL SELECT 'Sarat' UNION ALL SELECT 'SaRaT' UNION ALL SELECT 'SARAT'

    SELECT Names, CASE WHEN Names2=LOWER(Names2) THEN 1 ELSE 0 END...

Viewing 15 posts - 3,496 through 3,510 (of 3,957 total)