Jump to content

Recommended Posts

Posted

how big is the xml file ? how many records..

i can only tell how to identify...but dont know how to remove

Posted

I don't want to remove but I need the values. From query

Posted

Small xml two fields name same unnay how to extract values for both of them

Posted

I don't want to remove but I need the values. From query

query dont know

right click on grid form of xml file..copy as structured text..

then paste the same into excel.

then find dups..

 

this will help if you are tryin to debug somethin

Posted

Post full requirements when u ask man... not half n half... see this..

DECLARE @xml XML = '<Address>
<Details Person ="John" Country = "USA" />
<Details Person ="Mark" Country = "Australia" />
<Details Person ="Lynda" Country = "England" />
<Details Person ="Love" Country = "India" />
<Details Person ="Love" Country = "India" />
<Details Person ="Love" Country = "India" />
<Details Person ="Love" Country = "India" />
<Details Person ="Love" Country = "India" />
</Address>'

;WITH CTE AS
(
SELECT A.value('@Person[1]', 'VARCHAR(20)') as Person
	 , A.value('@Country[1]', 'VARCHAR(20)') as Country
FROM @xml.nodes('Address/Details') AS A(A)
)
SELECT Person, Country, Count(*) AS Cnt
FROM CTE
GROUP BY Person, Country
I posted the same already at sqlsaga.com .. check the article if u want to...

Group by kinda having count greater than 1 chestey u will get records with duplicates only...
Posted

bhayya u just want to know the duplicate value or u need a query for that bec if u want as above copy xml as text and past in another xml then click on data format which will show you the duplicates values..

Posted

if its oracle query this is what i know

 

 select column_name, count(column_name)

from table group by column_name having count (column_name) > 1

Posted

Post full requirements when u ask man... not half n half... see this..

DECLARE @xml XML = '<Address>
<Details Person ="John" Country = "USA" />
<Details Person ="Mark" Country = "Australia" />
<Details Person ="Lynda" Country = "England" />
<Details Person ="Love" Country = "India" />
<Details Person ="Love" Country = "India" />
<Details Person ="Love" Country = "India" />
<Details Person ="Love" Country = "India" />
<Details Person ="Love" Country = "India" />
</Address>'

;WITH CTE AS
(
SELECT A.value('@Person[1]', 'VARCHAR(20)') as Person
	 , A.value('@Country[1]', 'VARCHAR(20)') as Country
FROM @xml.nodes('Address/Details') AS A(A)
)
SELECT Person, Country, Count(*) AS Cnt
FROM CTE
GROUP BY Person, Country
I posted the same already at sqlsaga.com .. check the article if u want to...

Group by kinda having count greater than 1 chestey u will get records with duplicates only...
:)
Posted

if its oracle query this is what i know

 

 select column_name, count(column_name)

from table group by column_name having count (column_name) > 1

 

idi oracle code kaadu man, pure t-sql code... adi either oracle or sql server lo vaadukovachu... 89wyt.gif

×
×
  • Create New...