Simple:
[code lang=”sql”]
SELECT NEWID()
[/code]
So, why bother with this post? Well, I spend most of time working within Visual Studio so whenever I think about creating a new GUID I automatically think:
[code lang=”csharp”]
System.Guid newGUID = System.Guid.NewGuid();
[/code]
and then I realise that’s C#, then can’t remember if it’s [code lang=”sql”]SELECT NEWGUID[/code]
or [code lang=”SQL”]SELECT GUID[/code]
in t-sql so I Google it and realise when I see an example that the code I am looking for is [code lang=”sql”]SELECT NEWID()[/code]
. Hence the post!