d = 10 m = 2 y = 2011
I would like to create an Sql Date ty开发者_运维技巧pe using the above info ? How ?
DECLARE @d INT = 10,
@m INT = 2,
@y INT = 2011
SELECT DATEADD(DAY, @d - 1,
DATEADD(MONTH, @m - 1,
DATEADD(YEAR, @y - 1, CAST('00010101' AS DATE))))
if the column type is DateTime try to use the following:
set dateformat dmy
insert into TABLE_NAME (COL_NAME) VALUES ('10.02.2011')
精彩评论