DECLARE @str varchar(20);
DECLARE @dt datetime;
set @str='2012'+'-10'+'-10';
set @dt=CAST(@str AS datetime);
select @dt