Skip to content

Instantly share code, notes, and snippets.

@paulirwin
Last active March 3, 2016 16:56
Show Gist options
  • Save paulirwin/41239a4d67f8f72da639 to your computer and use it in GitHub Desktop.
Save paulirwin/41239a4d67f8f72da639 to your computer and use it in GitHub Desktop.
T-SQL NEWMSID() function for creating Azure Mobile Apps compatible IDs
CREATE VIEW [dbo].[GetNewId]
AS SELECT NEWID() AS [NewId]
CREATE FUNCTION [dbo].[NEWMSID]()
RETURNS varchar(50)
AS
BEGIN
RETURN (SELECT TOP 1 LOWER(REPLACE(CAST(NEWID as varchar(50)), '-', '')) FROM GetNewId)
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment