??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美一区在线观看视频,欧美日韩一区在线播放,97精品视频在线看http://www.aygfsteel.com/Werther/category/37767.htmlLive as if you were to die tomorrow. Learn as if you were to live forever.
zh-cnThu, 22 Oct 2009 13:53:41 GMTThu, 22 Oct 2009 13:53:41 GMT60SQL Server数据库开发的二十一条军?/title>http://www.aygfsteel.com/Werther/archive/2009/10/22/299331.htmlWertherWertherThu, 22 Oct 2009 04:53:00 GMThttp://www.aygfsteel.com/Werther/archive/2009/10/22/299331.htmlhttp://www.aygfsteel.com/Werther/comments/299331.htmlhttp://www.aygfsteel.com/Werther/archive/2009/10/22/299331.html#Feedback0http://www.aygfsteel.com/Werther/comments/commentRss/299331.htmlhttp://www.aygfsteel.com/Werther/services/trackbacks/299331.html在这里,我不打算介绍使用SQL Server的窍门,也不能提供一个包ȝ病的ҎQ我所做的是ȝ一些经?---关于如何形成一个好的设计。这些经验来自我q去几年中经受的教训Q一直来Q我看到许多同样的设计错误被一ơ又一ơ的重复?
阅读全文
]]>Excel的数据导入SQL server http://www.aygfsteel.com/Werther/archive/2009/02/24/256443.htmlWertherWertherTue, 24 Feb 2009 07:59:00 GMThttp://www.aygfsteel.com/Werther/archive/2009/02/24/256443.htmlhttp://www.aygfsteel.com/Werther/comments/256443.htmlhttp://www.aygfsteel.com/Werther/archive/2009/02/24/256443.html#Feedback0http://www.aygfsteel.com/Werther/comments/commentRss/256443.htmlhttp://www.aygfsteel.com/Werther/services/trackbacks/256443.html--可以通过使用 OPENDATASOURCE ?OPENROWSET 函数为特定目的导入数据?br />
--下列代码CZ也能?Excel Customers 工作表数据导入新?SQL Server 表:
Ҏ一Q?br />
SELECT * INTO XLImport3 FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0','Data Source=E:\Temp.xls;Extended Properties=Excel 5.0')...[Temp$]
Ҏ二:
SELECT * INTO XLImport4 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 5.0;Database=E:\Temp.xls', [Temp$])
Ҏ三:
SELECT * INTO XLImport5 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 5.0;Database=E:\Temp.xls', 'SELECT * FROM [Temp$]')
--像這個表裡面J續da錄
INSERT INTO XLImport5
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 5.0;Database=E:\Temp.xls', 'SELECT * FROM [Temp$]')
SELECT * FROM XLImport5
DROP TABLE XLImport3
DROP TABLE XLImport4
DROP TABLE XLImport5
]]>快速比较结构相同的两表http://www.aygfsteel.com/Werther/archive/2009/02/24/256421.htmlWertherWertherTue, 24 Feb 2009 06:11:00 GMThttp://www.aygfsteel.com/Werther/archive/2009/02/24/256421.htmlhttp://www.aygfsteel.com/Werther/comments/256421.htmlhttp://www.aygfsteel.com/Werther/archive/2009/02/24/256421.html#Feedback0http://www.aygfsteel.com/Werther/comments/commentRss/256421.htmlhttp://www.aygfsteel.com/Werther/services/trackbacks/256421.html /* l构相同的两表,一表有记录3万条左右Q一表有记录2万条左右Q我怎样快速查找两表的不同记录Q?/
-- l你一个测试方法,从northwind中的orders表取数据?br />
select * into n1 from orders
select * into n2 from orders
select * from n1
select * from n2
--d主键Q然后修改n1中若q字D늚若干?br />
alter table n1 add constraint pk_n1_id primary key (OrderID)
alter table n2 add constraint pk_n2_id primary key (OrderID)
select OrderID from (select * from n1 union select * from n2) a group by OrderID having count(*) > 1
/* 应该可以Q而且不同的记录的ID昄出来。下面的适用于双方记录一L情况Q?/
select * from n1 where orderid in (select OrderID from (select * from n1 union select * from n2) a group by OrderID having count(*) > 1)
-- 至于双方互不存在的记录是比较好处理的
--删除n1,n2中若q条记录
delete from n1 where orderID in ('10728','10730')
delete from n2 where orderID in ('11000','11001')
--*************************************************************
-- 双方都有该记录却不完全相?br />
select * from n1 where orderid in(select OrderID from (select * from n1 union select * from n2) a group by OrderID having count(*) > 1)
union
--n2中存在但在n1中不存的?0728,10730
select * from n1 where OrderID not in (select OrderID from n2)
union
--n1中存在但在n2中不存的?1000,11001
select * from n2 where OrderID not in (select OrderID from n1)
]]>E典SQL行列转换http://www.aygfsteel.com/Werther/archive/2009/02/20/255828.htmlWertherWertherFri, 20 Feb 2009 07:05:00 GMThttp://www.aygfsteel.com/Werther/archive/2009/02/20/255828.htmlhttp://www.aygfsteel.com/Werther/comments/255828.htmlhttp://www.aygfsteel.com/Werther/archive/2009/02/20/255828.html#Feedback0http://www.aygfsteel.com/Werther/comments/commentRss/255828.htmlhttp://www.aygfsteel.com/Werther/services/trackbacks/255828.html問題Q?假设有张学生成W?Test)如下
Name Subject Result
张三 语文 80
张三 数学 90
张三 物理 85
李四 语文 85
李四 数学 92
李四 物理 82
i果Q?br />
姓名 语文 数学 物理
张三 80 90 85
李四 85 92 82
DROP TABLE Test
create table Test(Name varchar(10),Subject Varchar(10),Result int)
insert Test
select '張三','語文',80 union all
select '張三','數學',90 union all
select '張三','物理',85 union all
select '李四','語文',85 union all
select '李四','數學',92 union all
select '李四','物理',82
go
SELECT * FROM Test
--用於多行的轉?br />
declare @sql varchar(4000)
set @sql = 'select Name'
select @sql = @sql + ',sum(case Subject when '''+Subject+''' then Result end) ['+Subject+']'
from (select distinct Subject from test) as a
select @sql = @sql+' from test group by name'
exec(@sql)
--如果行數這個看起來更加明瞭
select Name as 姓名,
sum(case Subject when '數學' then Result end) [數學],
sum(case Subject when '物理' then Result end) [物理],
sum(case Subject when '語文' then Result end) [語文]
from Test group by name
]]>_֦的SQL和SQL SERVER 与ACCESS、EXCEL的数据导入导{?http://www.aygfsteel.com/Werther/archive/2009/02/18/255254.htmlWertherWertherWed, 18 Feb 2009 05:57:00 GMThttp://www.aygfsteel.com/Werther/archive/2009/02/18/255254.htmlhttp://www.aygfsteel.com/Werther/comments/255254.htmlhttp://www.aygfsteel.com/Werther/archive/2009/02/18/255254.html#Feedback0http://www.aygfsteel.com/Werther/comments/commentRss/255254.htmlhttp://www.aygfsteel.com/Werther/services/trackbacks/255254.html阅读全文