Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 xml quesiton

Author  Topic 

basicconfiguration
Constraint Violating Yak Guru

358 Posts

Posted - 2012-05-31 : 20:30:30
select top 2 Ad.AdAttributes.value('(//attribute[@id=52]/item/@value)[1]','VARCHAR(400)')
,* from ad

select top 2 Ad.AdAttributes.value('(//attribute[@id=52]/item/@value)[1]','VARCHAR(400)')
from ad
any ideas why i get values in the first select statement but not in the 2nd statement?
I know in the first statement i have the *. but why does that matter?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-31 : 20:44:51
whats the xml you're trying to apply this code on?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

basicconfiguration
Constraint Violating Yak Guru

358 Posts

Posted - 2012-06-01 : 18:41:41
<mix mixID="21">
<attributes>


<attribute id="52" name="Property Description">
<item value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
</attribute>


</attributes>
</mix>
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-02 : 00:31:44
will you've only one node with id 52 always?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

basicconfiguration
Constraint Violating Yak Guru

358 Posts

Posted - 2012-06-11 : 19:32:25
I fixed this one. thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-11 : 19:44:06
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -