former Posted September 15, 2015 Report Posted September 15, 2015 4 vikram, use this for @iregion multiple values man... good luck man.. DECLARE @iRegion VARCHAR(100) = '1,2,3,4,5,6' SELECT iRegion FROM ( SELECT iRegion = x.i.value('(./text())[1]', 'int') FROM (SELECT [xml] = CONVERT(XML, '<i>'+ replace (@iRegion, ',', '</i><i>') +'</i>').query('.') ) AS a CROSS APPLY [xml].nodes('i') AS x(i) )AS y WHERE @iRegion IS NOT NULL Ikkada xml header enudku use chesthunaru ?? Region value Input use isthada or ? Can you explain how it works
4Vikram Posted September 15, 2015 Author Report Posted September 15, 2015 ltt :) thanks for ltt, problem night solved by sql god LoveIndia Ikkada xml header enudku use chesthunaru ?? Region value Input use isthada or ? Can you explain how it works calling Love vuncle, please clarify
loveindia Posted September 15, 2015 Report Posted September 15, 2015 Ikkada xml header enudku use chesthunaru ?? Region value Input use isthada or ? Can you explain how it works Comma separated values or some delimiter values ni read cheyyali antey sql lo direct ga cheyaledu man.. so we have to use a split function.. We can write a split function in many different ways, using CHARINDEX, LOOPS, TVF's etc etc.. this way of reading it through XML nodes is much faster and proven in case of varchar values because at the end we are reading from xml nodes but not varchar and no looping or anything... That is why I first added <i> and </i> to every record separated with comma (actually by replacing comma).. and then used inbuilt xml query open path method to parse Sql.. In terms of numbers, reads and duration this is by far the best method. Let me know if you have any questions man..
4Vikram Posted September 15, 2015 Author Report Posted September 15, 2015 Comma separated values or some delimiter values ni read cheyyali antey sql lo direct ga cheyaledu man.. so we have to use a split function.. We can write a split function in many different ways, using CHARINDEX, LOOPS, TVF's etc etc.. this way of reading it through XML nodes is much faster and proven in case of varchar values because at the end we are reading from xml nodes but not varchar and no looping or anything... That is why I first added <i> and </i> to every record separated with comma (actually by replacing comma).. and then used inbuilt xml query open path method to parse Sql.. In terms of numbers, reads and duration this is by far the best method. Let me know if you have any questions man.. bl@st bl@st bl@st
compose Posted September 15, 2015 Report Posted September 15, 2015 Comma separated values or some delimiter values ni read cheyyali antey sql lo direct ga cheyaledu man.. so we have to use a split function.. We can write a split function in many different ways, using CHARINDEX, LOOPS, TVF's etc etc.. this way of reading it through XML nodes is much faster and proven in case of varchar values because at the end we are reading from xml nodes but not varchar and no looping or anything... That is why I first added <i> and </i> to every record separated with comma (actually by replacing comma).. and then used inbuilt xml query open path method to parse Sql.. In terms of numbers, reads and duration this is by far the best method. Let me know if you have any questions man..
former Posted September 15, 2015 Report Posted September 15, 2015 Comma separated values or some delimiter values ni read cheyyali antey sql lo direct ga cheyaledu man.. so we have to use a split function.. We can write a split function in many different ways, using CHARINDEX, LOOPS, TVF's etc etc.. this way of reading it through XML nodes is much faster and proven in case of varchar values because at the end we are reading from xml nodes but not varchar and no looping or anything... That is why I first added <i> and </i> to every record separated with comma (actually by replacing comma).. and then used inbuilt xml query open path method to parse Sql.. In terms of numbers, reads and duration this is by far the best method. Let me know if you have any questions man.. Thanks Man. It takes List of values as Input & generates on fly table (split each value into a row)
Recommended Posts