ALTER PROCEDURE [dbo].[checkUser_SP] -- Add the parameters for the stored procedure here @Fieldname varchar(150), @FieldValue VARCHAR(150) AS BEGIN DECLARE @isExist bit DECLARE @columnName VARCHAR(150) select @columnName= @Fieldname SET NOCOUNT ON IF Exists ( Select null from dbo.TBL_Users WHERE @Fieldname = @FieldValue ) begin set @isExist=1 end else begin set @isExist=0 end select @isExist end
exec [checkUser_SP] @Fieldname='[User_ID]', @FieldValue=1
WHERE @Fieldname = @FieldValue
DECLARE @sql VARCHAR(MAX) = '' SET @sql = 'SELECT * FROM WHERE ' + @FieldName + '=' + @FieldValue EXEC(@sql)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)