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
 What is R( for in SQL statement

Author  Topic 

swells
Starting Member

3 Posts

Posted - 2007-07-31 : 07:15:07
Hi

In a SQL statement like this one:

CREATE FUNCTION udf_XML2Table (@pk int, @xCol xml)
RETURNS table WITH SCHEMABINDING
AS RETURN(
select @pk as PropPK, nref.value('.', 'varchar(max)') as propAuthor
from @xCol.nodes('/book/author/first-name') R(nref)
)


What is the R(nref) for/doing? I can't find any references to a R function? or whatever it is in SQL help.

Thanks

Stuart

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-07-31 : 07:17:33
You need to read the SQL Server 2005 Books Online.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-31 : 07:25:04
from BOL:

nodes (XQuery) as Table(Column)

Table(Column)
Is the table name and the column name for the resulting rowset.



_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

swells
Starting Member

3 Posts

Posted - 2007-07-31 : 10:28:31
quote:
Originally posted by Peso

You need to read the SQL Server 2005 Books Online.



E 12°55'05.25"
N 56°04'39.16"



Hi

I am indeed reading the SQL Server 2005 Books Online, but can find no reference to this. It looks like a function called R but it isn't listed as a function. I am not sure what else it might be.

As you seem to know that it is reference in SQL Books, perhaps you can give me a clue as to what to search for?

Cheers

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-31 : 10:39:44
my answer is a direct quote from Books online

look under nodes() index entry

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

swells
Starting Member

3 Posts

Posted - 2007-07-31 : 10:51:35
quote:
Originally posted by spirit1

my answer is a direct quote from Books online

look under nodes() index entry

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp



Aha - thanks very much spirit1 - considerably more helpful than Peso's response...

Cheers

Go to Top of Page

vgurule
Starting Member

1 Post

Posted - 2007-07-31 : 14:14:54
Can anyone tell me what the expression INNER JOIN means?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-31 : 14:37:09
exactly what it says it's an inner join between 2 sets of data.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-07-31 : 14:38:13
quote:
Originally posted by swells

Aha - thanks very much spirit1 - considerably more helpful than Peso's response...
You're welcome.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-08-01 : 02:29:20
quote:
Originally posted by Peso

quote:
Originally posted by swells

Aha - thanks very much spirit1 - considerably more helpful than Peso's response...
You're welcome.



E 12°55'05.25"
N 56°04'39.16"


You are so modest

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-01 : 02:31:58
What can I say?
Both Mladen and I told him to go read Books Online.
Maybe because I was the first to tell him? Maybe because Mladen spoon-fed him with the extra "nodes() index" thingy? Even when the word NODES is found in the query?

I don't know.


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

KenW
Constraint Violating Yak Guru

391 Posts

Posted - 2007-08-03 : 15:58:55
quote:
Originally posted by Peso

What can I say?



Peter,

Don't say anything. swells was rude in thanking spirit1 while taking a jab at you.

My way of handling people like that is just to remember the thanks I (didn't) get for spending the effort to try and help them when I read their questions in the future. I remember the lack of respect, and don't waste my time with them.

Eventually, their disrespect spreads far enough that they have trouble getting answers to questions like "Can you help me spend the million dollars I just won?".
Go to Top of Page
   

- Advertisement -