Forum Replies Created

Viewing 15 posts - 2,986 through 3,000 (of 6,036 total)

  • RE: Eliminating Cursors

    Kevin Rathgeber (6/16/2008)


    Just a quick comment about the table based.

    Move @loop_counter out of the while into an IF statement outside the loop. Though its minimal, there is no point...

  • RE: Looking back in Time..

    I don't specifically understand exactly how you're using your syntax,

    I don't. 🙂

    It was not actual syntax, of course.

    What I meant is you need to join table to itself

    ON T1.TermWeekNo =...

  • RE: Group By Price Ranges

    Did anybody of you guys hear about relational databases?

    Something about placing business rules into data, not into code?

    What if tomorrow some ranges will need to be changed?

    Can you customers do...

  • RE: Writing id's across multiple records 7 at a time..

    Matt Miller (6/16/2008)

    Good eye - didn't gather that the first time reading through!

    It's a follow-up for this:

    http://www.sqlservercentral.com/Forums/Topic517329-8-1.aspx

    I had a chance to miss the point there.

    :hehe:

  • RE: Writing id's across multiple records 7 at a time..

    Matt Miller (6/16/2008)


    Supplement Sergiy's great suggestion with something like a Tally Table, and you could write years worth of these at a time.

    His KCC table is actually Calendar table, kind...

  • RE: Writing id's across multiple records 7 at a time..

    You don't need sequence.

    You need number of weeks (7 day groups) from some initial date.

    UPDATE KCC

    SET sequence = DATEDIFF(dd, @InitDate, kcc_date)/7

    WHERE {if you need some}

  • RE: Looking back in Time..

    So I _also_ need to build in checking that stops this report firing when the holidays are on. It sounds pretty hardcore.. maybe I will simply have a separate schedule...

  • RE: Looking back in Time..

    You should have another column in your Calendar table - No of Term Week.

    It will hold all term weeks in sequence, 1st week of next term will continue the sequence...

  • RE: Percentage of records meeting criteria

    Yes, of course.

    Let's say, it was an intentional bug to make OP to analize and understand the code, not to just copy-paste it.

    😉

    Does it work as an excuse? 😛

    And just...

  • RE: Percentage of records meeting criteria

    SELECT COUNT(*) -- all rows

    *100/

    COUNT(CASE WHEN DateCol > @DateEdge THEN 1 ELSE NULL END) -- only rows meeting criteria to be counted

    FROM ...

  • RE: Not using a cursor, but get "Cursor is not open" error

    It's not SQL2K.

    It's ODBC driver you use for Linked Server connection.

    ODBC drivers don't have bulk insert functionality, when you do insert on remote server driver declares cursor and inserts row...

  • RE: Obtaining collation length of declared varchar variable

    Just declare variable as CHAR, not VARCHAR.

    SQL Server will do everything for you.

  • RE: Improve my where loop!

    Don't do 2 years.

    Do 1 week at a time. According to your estimation 1 week takes about 400 rows - nothing really.

    Run it once per 2 hours - and you're...

  • RE: Improve my where loop!

    Shark Energy (6/12/2008)

    The issue with doing this in one big chunk I feel is that if it goes wrong, thats 40,000 records in one hit. Individually you can track each...

  • RE: convert string to date

    Being in QA or EM press {F1}, click on "Index" tab, type "CAST", hit Enter twice.

    Scroll to the table with date conversion styles.

    Pay special attention to the line with ISO...

Viewing 15 posts - 2,986 through 3,000 (of 6,036 total)