日期:2014-05-16 浏览次数:20589 次
----------------------------------------------------------------
-- Author :DBA_HuangZJ(发粪涂墙)
-- Date :2014-03-18 21:44:18
-- Version:
-- Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64)
-- Apr 2 2010 15:48:46
-- Copyright (c) Microsoft Corporation
-- Enterprise Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)
--
----------------------------------------------------------------
--> 测试数据[A]
if object_id('[A]') is not null drop table [A]
go
create table [A]([Aid] int,[Aname] nvarchar(6))
insert [A]
select 1001,'sss' union all
select 1002,'win' union all
select 1003,'stu' union all
select 1004,'red' union all
select 1005,'ble'
--> 测试数据[B]
if object_id('[B]') is not null drop table [B]
go
create table [B]([Aid] int,[Cid] int,[Bdate] date)
insert [B]
select 1001,1,'2014-1-1' union all
select 1003,2,'2014-1-2'
--> 测试数据[C]
if object_id('[C]') is not null drop table [C]
go
create table [C]([Aid] int,[Cid] int,[Cdate] date)
insert [C]
select 1002,3,'2014