Last active
March 3, 2016 16:56
-
-
Save paulirwin/41239a4d67f8f72da639 to your computer and use it in GitHub Desktop.
T-SQL NEWMSID() function for creating Azure Mobile Apps compatible IDs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE VIEW [dbo].[GetNewId] | |
AS SELECT NEWID() AS [NewId] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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