stored procedure problem referencing database just created

  • I have a fairly complex SQL srcipt that creates tables, stored procedures and user-defined functions.

    These are all created fine.

    The problem starts when during the running of a script a Stored procedure is used to populate a database that was also created with the same SQL.

    The Query Analyxer advices that "Invalid object name 'obs_object_types'" - where 'obs_object_types' is the name of a table (this does exist and with the expected stucture) that is being populated via a stored procedure.

    I have tried breaking up the SQL script into separate Query Analyzer Executions but to no effect.

    This has been a problem for many INSERTS that have been managed by temporary Stored Procedures which I have got around by doing straight forward inserts in the SQL, however now I have reached a point where the INSERTS are not quite straight forward and take into account dependencies in several table which need to be managed by stored procedures.

    Any suggestions?

    [A relative newbie with the feeling he has bitten off a bit more than he can chew!!]

  • Are you in the correct database context when running this ?

    >>where 'obs_object_types' is the name of a table (this does exist and with the expected stucture)

    If you use full 3 part object naming on the above table, does the error go away ?

    ie:  dbname.owner.obs_object_types 

  • Ahh!!!

    Good point.

    Blindingly obvious now you point it out.

    Thank you.

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

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