We help IT Professionals succeed at work.

stored procedure how to pass parameter value in sql server 2012

Exec Igen_SP_DedupeSearch '<ROOT><Dedupe PerMobile  = '+ @m_PerMobile +' /><Dedupe PerAMobile  = '+ @m_PerAMobile +' /><Dedupe CorrMobile  = '+ @m_CorrMobile +' />
                    <Dedupe CorrAMobile  = '+ @m_CorrAMobile +' /></ROOT>','Custinfo'


how can i pass value @m_permobile values in xml.
Comment
Watch Question

Database Expert
Awarded 2016
Top Expert 2016
Commented:
Please use like below

Declare @m_PerMobile as varchar(100) = 'somevalue'

Declare @x as varchar(max) = '<ROOT><Dedupe PerMobile  = '+ @m_PerMobile +' /><Dedupe PerAMobile  = '+ @m_PerAMobile +' /><Dedupe CorrMobile  = '+ @m_CorrMobile +' />
                    <Dedupe CorrAMobile  = '+ @m_CorrAMobile +' /></ROOT>','Custinfo'

Exec Igen_SP_DedupeSearch @x

Open in new window

Author

Commented:
thanks jj :-)

Author

Commented:
thanks jj
To put it other way, you cannot pass an expression "a + b" as a parameter.

In this case, assign a + b to c and then pass c as a parameter. Hope it helps!