Forum Replies Created

Viewing 15 posts - 286 through 300 (of 330 total)

  • RE: Cursors Be Gone!

    RBarryYoung (1/5/2009)


    OK, on my box, I am getting the following results:

    Original cursor: 410ms

    RowNum (mine): 45ms

    Identity (Matt's): 123ms

    I can imagine that's about what you'd get - i...

  • RE: Cursors Be Gone!

    not afaik but Jeff will correct me if there is a way to do it.

    You can create a unique constraint across multiple columns, but not a clustered index over multiples...

    One...

  • RE: Cursors Be Gone!

    here's a ss2000 compatible version, using an indexed table variable for good measure 🙂

    DECLARE @countordered TABLE ([RowNum] INT IDENTITY (1,1) primary key clustered,

    ...

  • RE: grouping help

    If your table was

    CREATE TABLE someData

    (

    type varchar(20),

    month_nbr int,

    month_name varchar(20),

    amount decimal(10, 4)

    )

    then your query would be

    SELECT month_nbr,

    ...

  • RE: Cursors Be Gone!

    Farrell Keough (1/5/2009)


    ...as you cannot Index a @TableVariable...

    I thought that until Jeff Moden set me straight. You can declare a table variable like this

    declare @myTable TABLE (ID INT IDENTITY (1,...

  • RE: How to get the actual query text being fired for a particular operation. I'm trying to implement a trigger on a table where i need to store the query also.

    DBCC InputBuffer (SPID) will give you the text sent to the SQL Server, if that helps.

  • RE: insert in batch question

    I would use something similar to Chris' SQL - but I would create #BatchControl manually with a clustered index on the RowID, then use a counting loop similar to gyesql's...

  • RE: Cursors Be Gone!

    jacroberts (1/5/2009)


    There are no indexes useful to these queries on the WeblogEvents table. All queries do a full table scan and it looks like the UNION ALL one does two.

    I...

  • RE: add business days to a date

    Here's my take. )

    declare @numberBusinessDaysToAdd int

    declare @basedate datetime

    set @numberBusinessDaysToAdd = 14

    set @basedate = '20090101 17:30'

    -- first move base date on to the start of the next day

    set @basedate = dateadd(d,...

  • RE: Cursors Be Gone!

    TheSQLGuru (1/4/2009)


    Bottom line: DO NOT USE THIS UPDATE @VAR ... TRICK UNLESS YOU a) DON'T CARE ABOUT GETTING INCORRECT RESULTS OR b) YOU ARE VERY KNOWLEDGEABLE ABOUT YOUR SYSTEM,...

  • RE: Cursors Be Gone!

    Jeff Moden (1/3/2009)


    Well, I'll be... ...snip... I've gotta do some checking...

    I'm glad i'm not the only one doing all the learning! 😛

  • RE: Cursors Be Gone!

    It's been interesting actually - this thread has really reminded me that it's better to ask about intent rather than mechanic. By trying to ask 'how do I achieve X'...

  • RE: Cursors Be Gone!

    Jeff Moden (1/3/2009)


    On my box, I got a little over 6 seconds with the clustered index on the event's table. So, on my box, your code took 2 seconds...

  • RE: Cursors Be Gone!

    Jeff Moden (1/3/2009)


    Nope... unless you changed it for your server, the default Fill Factor is 90.

    Are you sure? On all the servers i've found, i get this result set for...

  • RE: Cursors Be Gone!

    Ok I guess you peeps have hit the hay 🙂

    @jacroberts - can you include that last one in your test runs monday? I know it's cheating, but I think coming...

Viewing 15 posts - 286 through 300 (of 330 total)