Forum Replies Created

Viewing 15 posts - 5,176 through 5,190 (of 10,144 total)

  • RE: SQL server 2008 query help

    mamzy.rahman (2/26/2013)


    HI thanks for your help but it came up with an error

    incorrect syntax near the keyword 'group'

    highlights groub by l01, l03

    The derived table - subselect - requires an alias.

  • RE: Complex SQL QUERY with DateDIFF

    SET DATEFORMAT DMY

    CREATE TABLE #TEMP (LogIndex int, UserID nvarchar (10), LogTime datetime)

    insert into #temp select 1, '01551 ', '20/02/2013 17:41:45.000' --

    insert into #temp select 2, '01551 ', '20/02/2013 17:41:45.900'

    insert into...

  • RE: procedure performance

    Thanks. The plans for each of the MERGE statements are very similar. Here's what I suggest you do; pick one of the statements and work with it in a query...

  • RE: strip out unmatched text with in a group

    ;WITH CTEAgg AS (

    SELECT

    GroupingID,

    GroupItemCount = COUNT(*) OVER (PARTITION BY GroupingID),

    [Description]

    FROM #TEMP

    )

    SELECT DISTINCT t.GroupingID, Item

    FROM #TEMP t

    OUTER APPLY (

    SELECT Item = STUFF(

    (

    SELECT ','+Item

    FROM (

    SELECT Item, GroupItemCount, [Description]

    FROM...

  • RE: procedure performance

    sathiyan00 (2/25/2013)


    hi ,

    i attached actual execution plan of my proc..please find attachment(results.txt)...

    Can you save it as a .sqlplan file and post, please?

  • RE: procedure performance

    Can you please post the actual execution plans of all three merge statements.

  • RE: strip out unmatched text with in a group

    Sure, it's in here[/url]. The followup discussion is well worth a read.

  • RE: strip out unmatched text with in a group

    Can you finish it from here?

    ;WITH CTEAgg AS (

    SELECT

    GroupingID,

    GroupItemCount = COUNT(*) OVER (PARTITION BY GroupingID),

    [Description]

    FROM #TEMP

    )

    SELECT GroupingID, Item

    FROM (

    SELECT

    GroupingID, GroupItemCount, [Description], Item

    FROM CTEAgg

    CROSS APPLY...

  • RE: ntile or something similar

    SELECT *

    FROM (

    SELECT *,

    Chunk = 1+(ROW_NUMBER() OVER(ORDER BY stress)-1)%4

    FROM #stress

    ) d

    ORDER BY Chunk, Stress

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

    L' Eomot Inversé (2/22/2013)


    mister.magoo (2/22/2013)


    And here is the code (with notes removed for brevity) and the changes underlined.

    Sorry if I have made a mistake, but I think this is valid.

    Looks...

  • RE: Update query for my new boss in my new job I am struggling with

    dwain.c (2/22/2013)


    Have you tried the solution I suggested?

    I'm thinking it will do what you need.

    I hope I didn't confuse you by putting Table2 into the CTE.

    Looks good to me. Same...

  • RE: Update query for my new boss in my new job I am struggling with

    I'm not so sure either - the tables might look like this:

    DROP TABLE #Table1

    SELECT

    *

    INTO #Table1

    FROM (

    SELECT Column1 = 'microsoft outlook 2007,microsoft 2007 outlook,microsoft out look 2007,microsoft 2007 office,microsoft office...

  • RE: Updating a % of cells in a Column

    wafw1971 (2/21/2013)


    I have 4 million lines of code....

    Four million lines of code would keep you quiet for a while! I guess you mean four million rows in a table?

    Read...

  • RE: T SQL statement issue

    chandrakant_gaurav (2/21/2013)


    Its embarassing :blush: . Thank you!!

    Heh - don't be embarrassed, you almost got there. Thanks loads for posting a sample script.

  • RE: T SQL statement issue

    So nearly there...

    SELECT

    calldate,

    Overall= SUM(talktime),

    A_Talktime= SUM(case when ID = 1 then talktime END),

    B_Talktime= SUM(case when ID = 2 then talktime END),

    C_Talktime= SUM(case when ID = 3 then talktime END)

    FROM...

Viewing 15 posts - 5,176 through 5,190 (of 10,144 total)