我想把下面的格式
年 月 日 编码 数量
2005 12 26 001001 435.6000
2005 12 26 001002 63.4000
2005 12 26 001003 173.1000
2005 12 26 001004 21.2000
2005 12 26 001005 63.0000
2005 12 26 001006 12.5000
2005 12 26 002004 1067.0000
2005 12 26 002005 15.0000
2005 12 26 002006 2044.0000
2005 12 26 002007 10.0000
变成这样 编码 数量
2005-12-26 001001 435.6000
2005-12-26 001002 63.4000
2005-12-26 001003 173.1000
2005-12-26 001004 21.2000
2005-12-26 001005 63.0000
2005-12-26 001006 12.5000
2005-12-26 002004 1067.0000
2005-12-26 002005 15.0000
2005-12-26 002006 2044.0000
2005-12-26 002007 10.0000
怎样转变啊,
年 月 日 编码 数量
2005 12 26 001001 435.6000
2005 12 26 001002 63.4000
2005 12 26 001003 173.1000
2005 12 26 001004 21.2000
2005 12 26 001005 63.0000
2005 12 26 001006 12.5000
2005 12 26 002004 1067.0000
2005 12 26 002005 15.0000
2005 12 26 002006 2044.0000
2005 12 26 002007 10.0000
变成这样 编码 数量
2005-12-26 001001 435.6000
2005-12-26 001002 63.4000
2005-12-26 001003 173.1000
2005-12-26 001004 21.2000
2005-12-26 001005 63.0000
2005-12-26 001006 12.5000
2005-12-26 002004 1067.0000
2005-12-26 002005 15.0000
2005-12-26 002006 2044.0000
2005-12-26 002007 10.0000
怎样转变啊,
cast(日 as varchar),编码,数量
from 表
insert into @t select 2005,12,26,'001001',435.6000
union all select 2005,12,26,'001002',63.4000
union all select 2005,12,26,'001003',173.1000
union all select 2005,12,26,'001004',21.2000
union all select 2005,12,26,'001005',63.0000
union all select 2005,12,26,'001006',12.5000
union all select 2005,12,26,'002004',1067.0000
union all select 2005,12,26,'002005',15.0000
union all select 2005,12,26,'002006',2044.0000
union all select 2005,12,26,'002007',10.0000
select [日期]=cast(年 as varchar)+'-'+cast(月 as varchar)+'-'+cast(日 as varchar),
编码,
数量
from @t