Forum Replies Created

Viewing 15 posts - 8,971 through 8,985 (of 10,144 total)

  • RE: Grouping on Date Range / Overlap

    Using the "running totals" method to take care of gaps...

    [font="Courier New"]SET DATEFORMAT DMY

    GO

    WITH testData(Start, [Stop] , v1, v2, ID )

    AS

    (

    SELECT CAST('01/01/09' AS DATETIME), CAST('31/01/09' AS DATETIME), 1399, 2499, 729275 UNION

    SELECT...

  • RE: Grouping on Date Range / Overlap

    The first start datetime and the last stop datetime in one row, for each ID?

  • RE: Grouping rows together

    Anu, a good first step would be to tidy up the original query. Check this against your original, it's much simpler - and therefore easier to work with, and should...

  • RE: problem in query

    pat (1/6/2009)


    it is only doing to one worksheet then!!

    Nah...IF (EXISTS (SELECT fname FROM testtable WHERE fname = @Testname AND day = @day))

  • RE: problem in query

    The day number would be ideal, why don't you use that instead of @Testname?

  • RE: problem in query

    pat (1/6/2009)


    then how will i write the insert and update please guide me!!

    thanks

    Sure! Remember that PRINT statement? Post what gets printed, say the first 10 lines for one worksheet.

  • RE: problem in query

    pat (1/6/2009)


    what?

    @Testname is assigned only outside the WHILE loop (WHILE @currentRow <= @dataEndRow) so remains static for each iteration.

    This conditional ...IF (EXISTS (SELECT fname FROM testtable WHERE fname = @Testname))

    ...

  • RE: problem in query

    pat (1/6/2009)


    yes

    Top work Pat, you've cracked it.

  • RE: problem in query

    Yes, it does. Is it always the same?

    IF (EXISTS (SELECT fname FROM testtable WHERE fname = @Testname))

    BEGIN

    ...

  • RE: problem in query

    pat (1/6/2009)


    no i does on insert but rest of them update like if worksheet has data till 24 rows it will run update till 24 but insert is one only!!

    The...

  • RE: problem in query

    pat (1/6/2009)


    Hi,

    i did that already and that's why i said that it only does one insert per worksheet(total count of worksheets are 29) and it updates the same reocords.

    thanks

    Pat

    So it...

  • RE: problem in query

    pat (1/6/2009)


    here is the thing when i did that the you u suggest.

    I only does one insert and rest of them update. and file has 29 worksheet so i get...

  • RE: problem in query

    pat (1/6/2009)


    i am blank now what do i need to do and how?

    Try this for starters IF (EXISTS...

  • RE: problem in query

    pat (1/6/2009)


    i only have two condition right now to do insert and update others are related to excel formating thanks

    also if i do only insert statement it work like charm....

Viewing 15 posts - 8,971 through 8,985 (of 10,144 total)