Skip to content

Instantly share code, notes, and snippets.

@vgashic
Last active January 17, 2020 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgashic/8b9c155fe390f3ba334c76b104528a93 to your computer and use it in GitHub Desktop.
Save vgashic/8b9c155fe390f3ba334c76b104528a93 to your computer and use it in GitHub Desktop.
-- SQL Server 2012+
-- Codes for CONVERT function
SELECT n.n
,TRY_CONVERT(VARCHAR(100), GETDATE(), n) AS date_format
FROM (
SELECT TOP 200 ROW_NUMBER() OVER (ORDER BY name) AS n
FROM sys.objects) AS n
WHERE TRY_CONVERT(VARCHAR(100), GETDATE(), n) IS NOT NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment