Tuesday, February 25, 2014

Filter rows based on Where condition AND-OR ?

HI


Try following code


CREATE PROC usp_dynamic_exec @where VARCHAR(Max)

AS

BEGIN

DECLARE @strQ AS NVARCHAR(max)



SET @strQ = 'Select * from yourTableName'



IF ISNULL(@where, '') <> ''

BEGIN

SET @strQ = @strQ + ' Where ' + @where -- where clause

END



EXECUTE sp_executesql @strQ

END

GO

Ref :http://ift.tt/187hUEF


http://ift.tt/1h9bgTG


http://ift.tt/Mqvuwh



Mark as Answer if you find it useful





Shridhar J Joshi Thanks a lot


No comments:

Post a Comment