Answers for "sql server cast datetime to date"

SQL
2

sql datetime as date

SELECT 
    CONVERT(DATE, GETDATE()) date;
Posted by: Guest on August-20-2020
0

convertir datetime a date

declare @fecha datetime 

set @fecha = GETDATE()

select convert(date ,@fecha)
Posted by: Guest on May-25-2020
0

sql cast date

DECLARE @counter INT = 0
DECLARE @date DATETIME = '2006-12-30 00:38:54.840'

CREATE TABLE #dateFormats (dateFormatOption int, dateOutput nvarchar(40))

WHILE (@counter <= 150 )
BEGIN
   BEGIN TRY
      INSERT INTO #dateFormats
      SELECT CONVERT(nvarchar, @counter), CONVERT(nvarchar,@date, @counter) 
      SET @counter = @counter + 1
   END TRY
   BEGIN CATCH;
      SET @counter = @counter + 1
      IF @counter >= 150
      BEGIN
         BREAK
      END
   END CATCH
END

SELECT * FROM #dateFormats
Posted by: Guest on December-02-2020

Code answers related to "sql server cast datetime to date"

Code answers related to "SQL"

Browse Popular Code Answers by Language