Re: How to know if a table exist in a Stored Procedure?



Hi,

use dbname
go
Select object_name(id) from syscomments where text like '%table_name%'

Replace table_name with actual table name.

Thanks
Hari
SQL Server MVP


"Grupo ESI" <Pedir@xxxxxxxxxxxxxxx> wrote in message
news:eRsvJT00GHA.720@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

Can anybody please tell me How to know if a table exist in a Stored
Procedure?

Thanks in advance,

--
Jorge L. Cotarelo




.



Relevant Pages

  • Re: How to know if a table exist in a Stored Procedure?
    ... Jorge L. Cotarelo ... Select object_namefrom syscomments where text like '%table_name%' ... SQL Server MVP ...
    (microsoft.public.sqlserver.msde)
  • Re: Find The Users and their roles for all the databases on the server
    ... SQL Server MVP ... "MANCPOLYMAN" wrote in message ... > can anyone point me in the right direction of how to loop through> sysdatabases, take each dbname and the use thatname.sysusers to display> all ... > fist cursor, of dbnames. ...
    (microsoft.public.sqlserver.programming)
  • Re: find which sprocs/views reference a table
    ... you can simply select the procs from syscomments where the name of the table ... SQL Server MVP ... > Is there a quick way to find what sprocs/views reference a table within? ...
    (microsoft.public.sqlserver.server)
  • Re: Execute SQL Statment
    ... instead of or right after print @dbname. ... SQL Server MVP ... > I need to execute "SQL Statments" that belong to a script ... > declare dbname_cur cursor for select from ...
    (microsoft.public.sqlserver.server)
  • Re: Alter identity -field?
    ... replace the dbname and table name with actual ... DBCC CHECKIDENT (tablename, RESEED, 4000) ... SQL Server MVP ... > I have a table with int identity field ). ...
    (microsoft.public.sqlserver.clients)

Loading