日期:2014-05-18 浏览次数:20753 次
declare @tb1 table (日期 varchar(10)) --如果是字符类型的就是这样
insert into @tb1
select '2012-1-2' union all
select '2012-1-3' union all
select '2012-1-4'
declare @tb2 table (姓名 varchar(4))
insert into @tb2
select '张三' union all
select '李四'
select * from @tb1 cross join @tb2 order by 1
/*
日期 姓名
---------- ----
2012-1-2 张三
2012-1-2 李四
2012-1-3 张三
2012-1-3 李四
2012-1-4 张三
2012-1-4 李四
*/
/*
--如果时间转成字符就这样:
select convert(varchar(10),日期,120) from tablename
*/