Alter PROCEDURE [dbo].[WP_SP_GET_TEXT_CUSTOM_FIELD]
@TableName T_NAM,
@ColumnName T_NAM,
@WhereColumn T_NAM,
@Criteria T_NAM,
@ColumnValue T_NAM Output
AS
BEGIN
Declare @SqlString varchar(1000)
declare @tmp table (T T_NAM)
Begin Try
Set @SqlString = 'SET QUOTED_IDENTIFIER OFF
SELECT ' + quotename(@ColumnName)
+ ' FROM ' + quotename(@TableName)
+ ' WHERE ' + quotename(@WhereColumn) + ' = "' + @Criteria + '"'
INSERT @tmp
Exec(@SqlString)
SELECT @ColumnValue = T from @tmp
Return 0
End Try
Begin Catch
Return ERROR_NUMBER()
End Catch
END
|