docs.intersystems.com
Home / InterSystems SQL Reference / SQL Functions / $TSQL_NEWID

InterSystems SQL Reference
$TSQL_NEWID
Previous section           Next section
InterSystems: The power behind what matters   
Search:  


A function that returns a globally unique ID.
Synopsis
$TSQL_NEWID()
Description
$TSQL_NEWID returns a globally unique ID (GUID). A GUID is used to synchronize databases on occasionally connected systems. A GUID is a 36-character string consisting of 32 hexadecimal digits separated into five groups by hyphens. Its data type is %Library.UniqueIdentifier.
$TSQL_NEWID is provided in InterSystems SQL to support InterSystems Transact-SQL (TSQL). The corresponding TSQL function is NEWID.
The $TSQL_NEWID function takes no arguments. Note that the argument parentheses are required.
The %Library.GUID abstract class provides support for globally unique IDs, including the AssignGUID() method, which can be used to assign a globally unique ID to a class. To generate a GUID value, use the %SYSTEM.Util.CreateGUID() method.
Examples
The following example returns a GUID:
SELECT $TSQL_NEWID()
See Also


Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-05-21 11:15:04