DECLARE @tmpDate TABLE
(
    [Formart Expression] NVARCHAR(10),
    [Converted Date] NVARCHAR(100)   
)

DECLARE @i INT
DECLARE @style NVARCHAR(10)
SET @i = 1
WHILE @i <= 50
BEGIN   
    SET @style = CONVERT(INT, '100') + CONVERT(INT, @i)       
    BEGIN try
        INSERT INTO @tmpDate ([Formart Expression] , [Converted Date])
        SELECT @style, CONVERT(NVARCHAR(100), GETDATE(), CONVERT(INT, @style))
    END TRY
    BEGIN CATCH
    END CATCH
    SET @i = @i + 1   
END

SELECT * FROM @tmpDate

Comments (1)

On July 11, 2011 at 10:59 PM , harish chandna said...

Diffrent date format while converting from datetime to string