Forum Replies Created

Viewing 15 posts - 121 through 135 (of 582 total)

  • RE: saving @@error

    Becuase the code is generic.

    bErrors is a flag which is set to 1 if any error occurs, then referred to at the end to determine whether to commit or roll...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Create procedure conditionally

    Sergiy - Messages are only errors ('failures') if you don't expect them. There's no requirement to alter anything here, just create procs if they don't already exist. For your requirement...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Pivoting a table showing values not using aggregate function

    You will end up with a lot of columns unless your dataset is tiny. And this isn't really like a PIVOT query, since normally a PIVOT leaves at least one...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Create procedure conditionally

    Dynamic SQL is not much fun here. You'd have to convert your procedure to double-up embedded quotes, and the resulting code would be fairly unreadable (all in red for a start).

    Since...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Functions with internal Sorting - is it cached?

    Presumably in the actual function, the input params limit the records? You can't have more than 4000 records per call to the function - if you ever did, it would break.

    So you...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Easiest query to find start of month

    Yes that's it! You still have to format as definition term, courier new, size 2 though.

    And of course, always <select all>,<copy> before clicking the button, in case of session timeout!...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Easiest query to find start of month

    select

    dateadd (month, datediff(month,...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Rewriting an update statement without using a cursor

    It might be better just to write a view for this - especially if drivers might change policy or state. That way you know the denormalised values always reflect the...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: TimeStamp from string ?

    Excellent cleanup job, much better for large recordsets, though not so generic. Your time has been well spent. It would be a good idea to add a comment when you...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: how to get the databases that the current login user can visit?

    Sorry, I'm using v9.

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: BCP Hint ! Rows_Per_Batch ! How do you use ?

    I'm about 95% certain that the order of the switches (params) doesn't matter, but just in case, the order specified in BOL would place the -b switch after the filename...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Help Required with 2 Triggers

    I know this kind of advice isn't always welcome, but you shouldn't use triggers for this. Based on my (possibly imperfect) understanding of your schema:

    1. The trigger you've provided isn't...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Variable versus explicit value

    And of course yours is in any case not a 'summary' query - which I assume means one with a significant degree of grouping.

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Converting hex to decimal issues

    To convert from binary(6) to bigint, you can just use:

    CAST(0x5F0500000100 as bigint)

    You can cast from binary type to an integer type provided that you don't stray into negative numbers, which...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: how to get the databases that the current login user can visit?

    sp_MSdbuseraccess

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

Viewing 15 posts - 121 through 135 (of 582 total)