Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Create a stored procedure

Author  Topic 

new2this
Starting Member

16 Posts

Posted - 2008-05-07 : 14:37:41
I have to create a stored procedure that accepts a column name and returns the name of the tables that have that column name. I'm not sure how to get it to accept the column name. Here's what I have so far:

create proc spTheNameOfTheProcedure
as
select table_name from information_schema.columns
where column_name = XXXXXX

no sure what to put where I have XXXXX

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-07 : 14:44:23
create proc spTheNameOfTheProcedure
(@columnName nvarchar(128))
as
select table_name
from information_schema.columns
where column_name = @columnName
go

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

new2this
Starting Member

16 Posts

Posted - 2008-05-07 : 15:17:53
Thanks
Go to Top of Page
   

- Advertisement -