• Wait - am I seeing correctly that your sproc actually creates the log record? If so, why isn't it simply putting the database info in the row it creates?

    If it isn't, what is creating the initial error log row? Whatever it is should be populating ALL FIELDS! It is TERRIBLY inefficient to insert a row and then turn around an update it with data that you should have had on insert.

    Also, look up db_id() and db_name() system functions. 

    Oh. and why are you storing both the database name and the database id? Same goes for procedure name and object id, right?? Wasted storage with zero benefit.

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service