日期:2014-05-17 浏览次数:20479 次
IF OBJECT_ID('Ta') IS NOT NULL
DROP TABLE Ta
Go
CREATE TABLE Ta
(
id INT,
[name] VARCHAR(20)
);
INSERT Ta
SELECT 1, 'a1' UNION
SELECT 2, 'a2' UNION
SELECT 3, 'a3'
IF OBJECT_ID('Tb') IS NOT NULL
DROP TABLE Tb
GO
CREATE TABLE Tb
(
id INT,
aid INT,
[values] VARCHAR(10),
dates DATETIME
) ;
INSERT Tb
select 1, 1, '12121', '2013-07-01' union
select 2, 2, '12121', '2013-07-01' union
select 3, 3, '12121', '2013-07-01' union
select 4, 1, '12121', '2013-07-02' union
select 5, 2, '12121', '2013-07-02' union
select 6, 3, '12121', '2013-07-02' union
select 7, 1, '12121', '2013-07-03' union