[mssql] CONVERT Datatime to string
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..