Hi guys,
how can i verify if a table or store proc exist and if not exist exit the procedure.
I tried with:
if object_id(tablename) is null
begin
return (-1)
end
but SQL give an error :
A RETURN statement with a return value cannot be used in this context,
theb same with:
IF EXISTS(select....sysobject...type = 'U')
.....
Any idea how to exit from a store proc if a table does not exit.
I thought :
select....sysobject...type = 'U'
if @@rowcount = 0
RETURN
Another way ...?
Any help will be very appreciated.
