Jump to content

Calling Sql Experts, Urgent Help


Recommended Posts

  • Replies 83
  • Created
  • Last Reply

Top Posters In This Topic

  • 4Vikram

    34

  • Raja123

    16

  • loveindia

    11

  • ramudu3

    4

Top Posters In This Topic

Posted

 

4 vikram, use this for @iregion multiple values man... good luck man.. tumblr_ns9q6zMIYu1tq73owo4_500.gif

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

Posted

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 gallery_24383_13_195938.gif

Posted

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..

tumblr_ns9q6zMIYu1tq73owo4_500.gif
Posted

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..

tumblr_ns9q6zMIYu1tq73owo4_500.gif

bl@st  bl@st  bl@st

Posted

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..

tumblr_ns9q6zMIYu1tq73owo4_500.gif

brahmanandam+agree.gif
Posted

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..

tumblr_ns9q6zMIYu1tq73owo4_500.gif

 

Thanks Man.

 

It takes List of values as Input & generates on fly table (split each value into a row)

×
×
  • Create New...