Forum Replies Created

Viewing 15 posts - 151 through 165 (of 197 total)

  • RE: Cursors and variables outside them

    As I said before, we KNOW it is has a valid value before the cursor begins looping.

    I tried the = 0 .vs <> -1 but will do so again.

  • RE: Help with stored procedure

    Thanks, I've got it now. Yes, all columns are required and it's easier to write. 😉

  • RE: Help with stored procedure

    Now, based on your post, I have added all the parameters for my Sp and am getting an error:

    The parameterized query '(@Payment_ID as int,

    ...

  • RE: Help with stored procedure

    I'm sorry for the confusion about edit capabilities. I *am* allowed to make changes and it looks like this *breakthrough* is going to be a big feather in my cap...

  • RE: Help with stored procedure

    Say, Gail, I got this from Mark Willis on Experts-Exchange. Basically it's building dynamic SQL.

    ALTER PROCEDURE [dbo].[Select_Payments]

    @PaymentID as int,

    ...

  • RE: Help with stored procedure

    Attached is the table creation script, one record of table data and a query along with it's execution plan.

  • RE: Help with stored procedure

    GilaMonster (7/24/2008)

    Since there's no changing that, ignore my comments. Maybe in the future if the system hits performance problems you can be the hero by telling them a possible cause....

  • RE: Help with stored procedure

    Any more tips on optimizing SP's where the WHERE clause is formatted like that?

  • RE: Help with stored procedure

    GilaMonster (7/24/2008)


    Just beware of parameter sniffing. Taht format of where clause tends to have very bad plan reuse and intermittent bad performance.

    For structures like that, WITH RECOMPILE may be necessary.

    This...

  • RE: Help with stored procedure

    I'm really kind of a newbie. The SP was generated by a tool that is used here and I am only modifying it to try to make it more efficient...

  • RE: Help with stored procedure

    if I include both dates, it returns all rows instead of only records in the range

    if I set the end date as null, it returns all rows.

    There are 946000 records...

  • RE: Help with stored procedure

    Would this work correctly?

    AND (((@PaymentDtTmStart IS NULL)

    AND (@PaymentDtTmEnd IS NULL))

    ...

  • RE: Help with stored procedure

    HUH? I just need to know how to check the ranges.

  • RE: problem altering char(10) to varchar(10) and trimming values

    So, do I look funny with egg on my face? Thanks a lot, you just saved my behind!

  • RE: Query help needed

    BTW, because of the way things are being run, I cannot use a DECLARE or IF, so...

    Here is the final working code:

    SELECT CASE

    WHEN EXISTS(SELECT 1 FROM...

Viewing 15 posts - 151 through 165 (of 197 total)