Forum Replies Created

Viewing 15 posts - 2,911 through 2,925 (of 10,144 total)

  • RE: SORT cost in union query

    Have you tried using appropriate date filters on each table?

    Something like StorePurchaseDate >= @8.

    Posting the actual execution plan of the query with the table insert part commented out might...

  • RE: Hourly

    One hour, the hour before the hour we are in:

    SELECT

    timeStart = DATEADD(hour,DATEDIFF(hour,0,getdate())-1,0),

    timeEnd =DATEADD(hour,DATEDIFF(hour,0,getdate()),0)

  • RE: Need help on a query in SQL 2005

    -- Since group allocation must take place sequentially row by row, your good options

    -- are quite limited. This solution uses a recursive CTE, you could also consider the

    -- Quirky...

  • RE: SQL SERVER Comma Separated values XML PATH

    cnu1252 (9/22/2014)


    HI

    Thanks for your help

    Still facing the same problem.Actually the original query is mentioned below.

    changed the column MenuName as NodeTraversed.

    First Iam going to mentioned below function which splits...

  • RE: SQL Query Taking Too Long

    -- this would help as Grant suggested, however refactoring the whole query

    -- to work as a cross-tab would be far more efficient.

    SELECT

    aa.[AccountID],

    aa.[AcctCode],

    aa.[AcctName],

    aa.[Segment0],

    aa.[SegmentName1],

    aa.[SegmentShortName1],

    ...

  • RE: Checking sequence of codes

    richardmgreen1 (9/12/2014)


    Thanks Chris

    I'm going to bookmark this little lot as I'm fairly certain it will come up again (and again, and again).

    You're welcome.

    I'd recommend you work through the delimitedsplit article....

  • RE: Checking sequence of codes

    richardmgreen1 (9/12/2014)


    Thanks Chris

    Just to check my understanding of this, it looks like the splitter will help to give each code it's own line number to start with.

    Then, the SELECT after...

  • RE: Amend function to include time values

    Choose how you wish to tackle DaysToCount, round up or down or whatever and incorporate it into the function.

    CREATE FUNCTION [dbo].[CountFractionalHolidays]

    /*

    Put in some explanatory notes here

    */

    ...

  • RE: Checking sequence of codes

    Here you go, Richard. I think you know about Jeff Moden's splitter already:

    ;WITH SplitData AS (

    SELECT *

    FROM (SELECT ID = ROW_NUMBER() OVER(ORDER BY (SELECT NULL)), Code FROM #test) t

    CROSS...

  • RE: Checking sequence of codes

    Another question:

    come before

    Q07

    Q08.

    Both of them or either of them?

  • RE: Amend function to include time values

    -- Following on from the last post, here's the same query as above with a couple of amendments.

    -- Firstly, I've put the remaining filters into place, the two flag...

  • RE: Checking sequence of codes

    richardmgreen1 (9/12/2014)


    Hi all

    I've run across a bit of a problem with checking the sequence of codes in a string.

    The codes are semi-colon separated in this string, but they are also...

  • RE: Performance issue in store procedure

    polo.csit (9/12/2014)


    Table

    Idintno410 0 no(n/a)(n/a)NULL

    Titlenvarcharno1000 no(n/a)(n/a)Latin1_General_CI_AS

    CompanyNamenvarcharno1000 no(n/a)(n/a)Latin1_General_CI_AS

    .

    .

    .

    Index

    IX_CompanyNamenonclustered located...

  • RE: Amend function to include time values

    Much better, thank you.

    2. The 2nd scenario is the issue I am having which is not covered by the function.

    If the start date is on a saturday (Sept 6th)...

  • RE: Amend function to include time values

    Can you amend that post to use a 24-hour clock please?

Viewing 15 posts - 2,911 through 2,925 (of 10,144 total)