日期:2014-05-17 浏览次数:20463 次
--IF object_id('t1') IS NOT NULL -- DROP TABLE t1 CREATE TABLE t1(ID INT IDENTITY(1,1) PRIMARY KEY,col1 INT) INSERT INTO t1 (col1) VALUES(1) INSERT INTO t1 (col1) VALUES(2) INSERT INTO t1 (col1) VALUES(3) INSERT INTO t1 (col1) VALUES(4) SELECT a.number,b.col1 FROM ( SELECT number FROM master..spt_values WHERE type='p' AND number IN('1','2','3','4','5','6') ) AS a LEFT JOIN t1 AS b ON a.number=b.col1
------解决方案--------------------