//FieldDepencencies in SQL Server
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[SP_FieldDepencencies]
@DataBaseName varchar(50),
@TableName varchar(50),
@FieldName varchar(50)
as
begin
declare @@Query varchar(max)
set @@Query = 'use '+@DataBaseName
set @@Query =@@Query+' select distinct name
from syscomments c
join sysobjects o on c.id = o.id
where TEXT like ''%'+@TableName+'%'' and TEXT like ''%'+@FieldName+'%'''
print @@Query
Exec (@@Query)
end
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[SP_FieldDepencencies]
@DataBaseName varchar(50),
@TableName varchar(50),
@FieldName varchar(50)
as
begin
declare @@Query varchar(max)
set @@Query = 'use '+@DataBaseName
set @@Query =@@Query+' select distinct name
from syscomments c
join sysobjects o on c.id = o.id
where TEXT like ''%'+@TableName+'%'' and TEXT like ''%'+@FieldName+'%'''
print @@Query
Exec (@@Query)
end
No comments:
Post a Comment