Trouble running sql 2008 query captured from profiler on sql 2000

  • I ran a trace against our development server which is SQL 2008. If I copy one of the sql statements and run it against the same database running on SQL 2000 the statement will run. If I comment out one of the lines in the select I get an error that the table is invalid. If I manually type the same query in SQL 2000 then it works just fine. If I take the SQL statement that failed and copy to notepad and then copy and paste it back into SSMS then it works. This leads me to believe that there is some hidden data being copied from profiler that sql 2000 doesn't like.

    Works

    SELECT oe_pick_ticket.pick_ticket_no

    ,oe_pick_ticket.order_no

    FROM oe_pick_ticket

    WHERE (oe_pick_ticket.order_no = '1803353') AND

    (oe_pick_ticket.delete_flag <> 'Y') AND

    ((invoice_no IS NULL) OR (invoice_no = 0))

    Doesn't Work

    SELECT oe_pick_ticket.pick_ticket_no

    --oe_pick_ticket.order_no

    FROM oe_pick_ticket

    WHERE (oe_pick_ticket.order_no = '1803353') AND

    (oe_pick_ticket.delete_flag <> 'Y') AND

    ((invoice_no IS NULL) OR (invoice_no = 0))

    Error message

    Msg 107, Level 16, State 3, Line 1

    The column prefix 'oe_pick_ticket' does not match with a table name or alias name used in the query.

  • Does eliminating the table prefixes on the column names make any difference?

    _________________________________
    seth delconte
    http://sqlkeys.com

  • No. Again if I copy the code and paste it in notepad and then copy from notepad and paste back to SSMS it works.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply