DECLARE @index INT = 100
DECLARE @result VARCHAR(30)
WHILE @index < 132
BEGIN
BEGIN TRY
SET @result = CONVERT(VARCHAR(30), GETDATE(), @index)
PRINT convert(char(3), @index) + ', ' + @result
END TRY
BEGIN CATCH
print convert(char(3), @index) + ', ' + 'NOT_CONVERTED'
END CATCH
SET @index = @index + 1
END
100, 06 26 2017 6:33PM
101, 06/26/2017
102, 2017.06.26
103, 26/06/2017
104, 26.06.2017
105, 26-06-2017
106, 26 06 2017
107, 06 26, 2017
108, 18:33:55
109, 06 26 2017 6:33:55:077PM
110, 06-26-2017
111, 2017/06/26
112, 20170626
113, 26 06 2017 18:33:55:077
114, 18:33:55:077
115, NOT_CONVERTED
116, NOT_CONVERTED
117, NOT_CONVERTED
118, NOT_CONVERTED
119, NOT_CONVERTED
120, 2017-06-26 18:33:55
121, 2017-06-26 18:33:55.077
122, NOT_CONVERTED
123, NOT_CONVERTED
124, NOT_CONVERTED
125, NOT_CONVERTED
126, 2017-06-26T18:33:55.077
127, 2017-06-26T18:33:55.077
128, NOT_CONVERTED
129, NOT_CONVERTED
130, 2 ???? 1438 6:33:55:077PM
131, 2/10/1438 6:33:55:077PM