1-- Specifically for Oracle
2
3-- EXAMPLE
4CAST('732.98' AS INT)
5
6/* SYNTAX
7CAST(<value_to_cast> AS <data_type_to_cast_to>)
8*/
1CAST('2006-04-25T15:50:59.997' AS date) AS Date,
2
3CAST('2006-04-25T15:50:59.997' AS time) AS Time,
4
5CAST('2006-04-25T15:50:59.997' AS datetime) AS Datetime,
1DECLARE @counter INT = 0
2DECLARE @date DATETIME = '2006-12-30 00:38:54.840'
3
4CREATE TABLE #dateFormats (dateFormatOption int, dateOutput nvarchar(40))
5
6WHILE (@counter <= 150 )
7BEGIN
8 BEGIN TRY
9 INSERT INTO #dateFormats
10 SELECT CONVERT(nvarchar, @counter), CONVERT(nvarchar,@date, @counter)
11 SET @counter = @counter + 1
12 END TRY
13 BEGIN CATCH;
14 SET @counter = @counter + 1
15 IF @counter >= 150
16 BEGIN
17 BREAK
18 END
19 END CATCH
20END
21
22SELECT * FROM #dateFormats