BCP Utility

  • Does anyone know how the BCP utility functions behind the scenes?

    I am using it for a query out executing a stored proc. The proc updates a field with a timestamp from a variable. After it runs the fields seem to have three different update times, just milliseconds apart.

    Would BCP somehow execute the proc more than once?

  • Probably not. I wouldn't be surprised if the times you are seeing are during the execution of the procedure. It probably uses GETDATE() in an update statement, correct? Try setting a variable to the current date/time (getdate()) prior to the update in the proc and use the variable where you have getdate().

  • The getdate() is already being assigned to a variable, and used for the update. The update also should touch only 5 records (it is using a top 5). If the proc is run on it's own it works correctly, updating only 5 records, and all with the same time to the millisecond.

  • Well, that is all I can come up with since I can't see what you see.

  • I am helping someone else with this. If the next few things attempted don't fix it, I will gather the DDL and such and post it.

  • Well, we did find out it was executing the stored proc 3 times.

    This link confirmed what we were seeing

    http://social.msdn.microsoft.com/Forums/en/transactsql/thread/b8340289-7d7e-4a8d-b570-bec7a0d73ead

  • David Lester (5/11/2012)


    Well, we did find out it was executing the stored proc 3 times.

    This link confirmed what we were seeing

    http://social.msdn.microsoft.com/Forums/en/transactsql/thread/b8340289-7d7e-4a8d-b570-bec7a0d73ead%5B/quote%5D

    That post shows no proof, i.e. no code to reproduce the issue. wBob is a trusted SQL Server professional, and he could not repro the issue. I am not saying you are not seeing what you are seeing, but let's just say I would like to see it too. Can you post repro code?

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 7 posts - 1 through 6 (of 6 total)

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