The GRAPH_ID_FROM_NODE_ID function

This function is similar to the previous one; it returns a graph_id for a given node_id. The following code returns the graph_id for the dbo.TwitterUser node table:

SELECT GRAPH_ID_FROM_NODE_ID('{"type":"node","schema":"dbo","table":"TwitterUser","id":0}');

The return value is 0, as shown in the following output:

--------------------
0

It does parse the input string in the same way as the OBJECT_ID_FROM_NODE_ID function and does not validate whether an entry with the returned graph_id exists in the given node table. Therefore, the following code will return a value, even though there is no entry with a value of 567890 for the graph_id in the node table:

SELECT GRAPH_ID_FROM_NODE_ID('{"type":"node","schema":"dbo","table":"TwitterUser","id":567890}');

Here is the output:

-----------
567890

The function returns NULL values and exceptions analogous to the OBJECT_ID_FROM_NODE_ID function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.171.168