Add to Google Add to My Yahoo!

Live Chat Here


Articles on ASP.NET

Friday, September 21, 2007

Remaining Part of Dynamic SQL

declare

@a nvarchar(1024),@b nvarchar(256)

set

@a = 'rulename'

set

@b ='stauts =N' + quotename('true','''' )

print

@a

set

@a = 'select ' + @a + ' from [Rule]' + 'where' + ' ' +@b

exec

(@a)

 

 

set

@a = ' select varname + N' + quotename(' ', '''') + ' + operation + N' + quotename(' ', '''') + ' + varvalue + N' + quotename(' ', '''') + 'as Condition , Connector from rulevariables where ruleid=20'

exec

(@a)

--
Regards,
Munish Kalra

Concatenating Columns in SQL SERVER TO SINGLE ROW . BUILDING BLOCK FOR SEARCHING


DECLARE

@temp varchar(150)

SELECT

@temp= COALESCE(@temp + ' ','' )+ varname + '' + operation + '' + varvalue +' ' + isnull (connector,'')

FROM

RuleVariables

WHERE

(RuleID = 20)

print

@temp
--
Regards,
Munish Kalra