create PROCEDURE ei_sp_available @Table varchar(100), @Type varchar(100) AS BEGIN SET NOCOUNT ON; Execute ('select count(*) from '+@Table+' where [Name]= '+@Type+'') END exec ei_sp_available ei_country,CountryName error:invalid CountryName
CountryName
invalid
exec ei_sp_available ei_country,'CountryName'
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO create PROCEDURE [dbo].[ei_sp_available] -- Add the parameters for the stored procedure here @Table varchar(100)=null, @FieldName varchar(100)=null, @FieldValue varchar(100)=null AS BEGIN -- exec ei_sp_available 'ei_country','country' ,'India' Execute ( 'select count(*) from '+ @Table +' where ' + @FieldName +' ='''+ @FieldValue +'''' ) END
create PROCEDURE [dbo].[ei_sp_available] -- Add the parameters for the stored procedure here @TableName varchar(100), @FieldName varchar(100), @FieldValue varchar(100) AS BEGIN Execute ('select count(*) from '+ @TableName +' where ' + @FieldName +' ='''+ @FieldValue +'''') END
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)