sql - Error in stored procedure while join operation -



sql - Error in stored procedure while join operation -

i have written stored procedure below

create table #temp( tloaid int, tloaname nvarchar(50) ); -- drop table #temp; declare @string varchar(max) = 'casualty, insurance, debit,'; -- set @string = @loastringparam; select b.loaid tloaid, b.loaname tloaname #temp (select rtrim(ltrim(split.a.value('.', 'varchar(100)'))) info (select cast ('<m>' + replace(@string, ',', '</m><m>') + '</m>' xml) data) cross apply data.nodes ('/m') split(a)) bring together tbloa b on a.data = b.loaname; if(exists(select tbploa.loaid tbploa tbploa.loaid not in(select #temp.tloaid #temp) , pid= @pid)) begin .... .... end ...

now it's throwing error message like

incorrect syntax near 'a'.

i not able trace error!!! please help me!!!

try changing alias name this.

create table #business (bid int,bname varchar(50) ) insert #business values (1,'casualty'),(2,'insurance'),(3,'debit'),(4,'jkl') declare @strng varchar(max) = 'casualty, insurance, debit,' select b.bid tbib, b.bname tbname #temp (select rtrim(ltrim(split.sp.value('.', 'varchar(100)'))) info (select cast ('<m>' + replace(@strng, ',', '</m><m>') + '</m>' xml) data) cross apply data.nodes ('/m') split(sp)) oo bring together #business b on oo.data = b.bname select * #temp

sql sql-server sql-server-2008

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -