DECLARE @str varchar(20);
DECLARE @dt datetime;
set @str='2012'+'-10'+'-10';
set @dt=CAST(@str AS datetime);
select @dt
DECLARE @str varchar(20);
DECLARE @dt datetime;
set @str='2012'+'-10'+'-10';
set @dt=CAST(@str AS datetime);
select @dt
转载于:https://www.cnblogs.com/sparry/archive/2012/11/17/2774457.html