Forum Replies Created

Viewing 15 posts - 3,346 through 3,360 (of 10,144 total)

  • RE: Select * if null passed else by INT

    ScottPletcher (5/14/2014)


    ChrisM@Work (5/14/2014)The execution plans for those two queries is likely to be completely different. If you were to write the query as a single "catch-all" query, it would be...

  • RE: Select * if null passed else by INT

    The execution plans for those two queries is likely to be completely different. If you were to write the query as a single "catch-all" query, it would be optimised either...

  • RE: T-SQL query with loop ?

    /* You missed out the ddl for table #C, the ReleaseNumber on the

    last row of your sample data is probably incorrect, and your spec is sloppy

    and...

  • RE: how to aggregate interval data to hourly values?

    Luis Cazares (5/13/2014)


    I wouldn't use the cross apply, but it's just a personal preference.

    It should be interpreted the same way as Chris M's query.

    SELECT MeteriD,

    Reading = SUM(Reading),

    DateByHour =...

  • RE: Please help to reduce query time

    ashok84.kr (5/12/2014)


    ...number of rows returned = 1 million and time taken 35 seconds....

    How are you timing this? It could take 35 seconds just to return this number of rows to...

  • RE: Change display of result set from 'showing data as rows, to showing data as one or more columns'

    Try this article on Dynamic Crosstabs[/url].

  • RE: Running totals for general ledger

    haddoque2000 (5/13/2014)


    ...

    Sample rows:

    FinKeyDateKeyOrgaKeyCliKeyAccoKeyDim1KeyDim2KeyAmountDate

    19720101001113611-541261,822010-10-01 00:00:00.000

    19820101031113611-541261,822010-10-31 00:00:00.000

    19920101101113611-550252,822010-11-01 00:00:00.000

    20020101201113611-559243,822010-12-01 00:00:00.000

    20120110131113611-568234,822011-01-31 00:00:00.000

    2022004050611117116103332004-05-06 00:00:00.000

    2032004050711117111436942004-05-07 00:00:00.000

    204200405101111711-1466222004-05-10 00:00:00.000

    205200405111111711-1595222004-05-11 00:00:00.000

    ...

    Had you read the article suggested by Jeff and others you would have posted this as INSERTs. We're now...

  • RE: how to aggregate interval data to hourly values?

    Megha P (5/13/2014)


    Don't know performance wise it is good or bad..but i come up with below code

    create Table #temp

    (MeteriD INT,

    ReadingDate DATETIME,

    Reading INT

    )

    INSERT #temp

    SELECT 3969,'1/01/2014 0:00', 0

    UNION ALL

    SELECT 3969,'1/01/2014 0:15', ...

  • RE: count events on date

    Eirikur Eiriksson (5/12/2014)


    Lynn Pettis (5/12/2014)


    Eirikur Eiriksson (5/12/2014)


    ChrisM@Work (5/12/2014)


    Eirikur Eiriksson (5/12/2014)


    Mike Saunders NL (5/12/2014)


    Hi, this works! Thanks

    The only thing that is missing is that the days with no events are not...

  • RE: count events on date

    Eirikur Eiriksson (5/12/2014)


    Mike Saunders NL (5/12/2014)


    Hi, this works! Thanks

    The only thing that is missing is that the days with no events are not mentioned. Is there a way to display...

  • RE: SELECT IN CLAUSE

    Hi Luis

    Sorry mate, answered here. I hadn't noticed this thread or I would have put up a dupe notice.

  • RE: count events on date

    ;WITH DateRange AS (

    SELECT EventDate

    FROM (

    SELECT

    FirstDate = DATEADD(month,DATEDIFF(month,0,MIN(startdate)),0),

    LastDate = DATEADD(month,1+DATEDIFF(month,0,MAX(enddate)),-1)

    FROM #events

    ) e

    CROSS APPLY (

    SELECT TOP(1 + DATEDIFF(day,e.FirstDate,e.LastDate))

    EventDate = DATEADD(day,ROW_NUMBER() OVER(ORDER BY (SELECT NULL))-1,FirstDate)

    FROM

    (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) d (n),...

  • RE: Running totals for general ledger

    Can you set up some sample data for folks to code against? Coding up a running totals script is easy. Trying to imagine how your data looks before and after...

  • RE: Drop Identity column from temp table

    SELECT

    'INSERT INTO ' + t2.table_name + CHAR(10) +

    ' (' + STUFF([target].ColumnList,1,2,'') + ')' + CHAR(10) +

    'SELECT ' + STUFF([source].ColumnList,1,2,'') + CHAR(10) +

    'FROM ' +...

  • RE: Drop Identity column from temp table

    hoseam (5/12/2014)


    Yes, any columns in the Hosea_tblDef_Cloning_Table, under the column [COLUMN_NAME], will be the combination.. In our select list selecting new values and where clause comparing with old values..

    Just to...

Viewing 15 posts - 3,346 through 3,360 (of 10,144 total)