<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_♨  NewSea#'s Sky_分类_SQL Script</title><id>http://feed.cnblogs.com/blog/u/21750/category/72778/rss</id><updated>2012-06-04T23:38:24Z</updated><generator>feed.cnblogs.com</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/category/72778.html"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/21750/category/72778/rss"/><entry><id>http://www.cnblogs.com/newsea/archive/2012/03/23/2413991.html</id><title type="text">转：SQL Server 2008新特性之Merge</title><summary type="text">转自http://blog.csdn.net/wangjianming45/article/details/7265949原文SQL 比较乱，整理了一下USE testGOSET NOCOUNT ON--create table for testingIF OBJECT_ID('dbo.tb_testMerge','U')IS NOT NULL DROP TABLE dbo.tb_testMerge;GO CREATE TABLE tb_testMerge( UserID INT IDENTITY(1,1)NOT NULL ,UserName VARCHAR(1</summary><published>2012-03-23T09:22:00Z</published><updated>2012-03-23T09:22:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2012/03/23/2413991.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2012/03/23/2413991.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2012/03/13/2395169.html</id><title type="text">SQL 生成 Word 文档新思路.</title><summary type="text">目前是PowerDesigner 的唯一可用功能了吧,想个简单办法实现之。1.把数据导入到 Excel这种方式比较灵活,可以方便的利用 OleDb接口,从SQLServer元数据表读取数据,写入到 Excel2.把Excel导入到Word为了定义出哪是表描述,哪是列描述,可以人为的添加标记.如 表标记前有两个空行.表标记后有一个空行. 利用 DDE 或剪贴板,把数据导入到 Word.3.利用宏,美化Word灵活地利用宏,对Word进行美化.对Word自动生成标题,大纲等.灵活,强大,相信不比PD效果差.(待实现.)</summary><published>2012-03-13T15:08:00Z</published><updated>2012-03-13T15:08:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2012/03/13/2395169.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2012/03/13/2395169.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2012/03/04/2379274.html</id><title type="text">ReportViewer，RDLC 报表开发之个性化样式</title><summary type="text">报表开发中，客户对样式提出了要求：1.工具栏上显示每页条数2.只导出Excel，不需要下拉菜单。3.报表上显示的图表，分页时，每页都要显示，但导出后，图表是一个，且都在最下面。另外的功能点:4.每页显示标头5.标题行和 奇偶行样式解决方案：1.工具栏上显示每页条数 搜索无果后(RportViewer 没提供类似的功能吧.),暴力解决.好像网上也有类似的方案. /// &lt;summary&gt; /// 给报表添加每页条数. Udi 2012年3月2日 /// &lt;/summary&gt; /// &lt;param name="Report"&gt;&lt;/par</summary><published>2012-03-04T07:19:00Z</published><updated>2012-03-04T07:19:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2012/03/04/2379274.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2012/03/04/2379274.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2012/03/04/2379250.html</id><title type="text">ReportViewer，RDLC 报表开发之分页</title><summary type="text">前段时间开发报表,采用了 ReportViewer + RDLC , 开发整理如下.分页思路MS 的DataGrid ，GridView，和 ReportViewer 分页机制差不多，都需要绑定全部数据，MS控件自动处理分页。 只是ReportViewer 是按页面布局分页的，而不是按数据条数。绑定全部数据的方式会无谓的增加服务器压力，尤其是数据计算和表关联多的情况下。为了减轻服务器压力，我们采用数据分页，数据传到应用服务器端后，再加工一下（插入空数据），做也可分页数据源。如果数据库有 100 条数据，每页10条数据，那存储过程返回10条数据后，还需要再插入90条数据。当数据大的时候，插入的数</summary><published>2012-03-04T06:48:00Z</published><updated>2012-03-04T06:48:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2012/03/04/2379250.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2012/03/04/2379250.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2012/03/04/2379175.html</id><title type="text">快速整理列说明.SQL2008.</title><summary type="text">对数据库表字段名很多重复的时候,我们希望,把所有的 Name 设置为 名称 .先查引用最多的列:select c.name , count(1) as coufrom sys.columns as c join sys.tables as t on ( c.object_id = t.object_id)where t.type = 'U'group by c.name,t.typehaving count(1) &gt; 1 order by count(1) desc 再用下列SQL作为模板, 按 Ctrl + T 执行select 'EXECUTE sp_adde</summary><published>2012-03-04T04:59:00Z</published><updated>2012-03-04T04:59:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2012/03/04/2379175.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2012/03/04/2379175.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2012/02/28/2371479.html</id><title type="text">[转]64位环境中使用SQL查询excel的方式解决 .</title><summary type="text">原：http://blog.csdn.net/claro/article/details/6401819</summary><published>2012-02-28T06:07:00Z</published><updated>2012-02-28T06:07:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2012/02/28/2371479.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2012/02/28/2371479.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2012/02/26/2368625.html</id><title type="text">Sql2008中添加程序集.</title><summary type="text">C# 建立数据库 CRL 项目 .Net 3.5public partial class MyClr{ [Microsoft.SqlServer.Server.SqlFunction] public static SqlBoolean CLRFBitContains(string MyBigIntValue, int Row) { // 在此处放置代码 return (new MyBigInt(MyBigIntValue) &amp; MyBigInt.CreateByBitPositon(Convert.ToUInt32(Row))) == MyBigI...</summary><published>2012-02-26T06:30:00Z</published><updated>2012-02-26T06:30:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2012/02/26/2368625.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2012/02/26/2368625.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2011/10/24/2223005.html</id><title type="text">left join ,innerJoin</title><summary type="text">declare @t1 table ( id int , val varchar(20)) insert into @t1 select 1 , 'a' union select 2 , 'b' union select 3 , 'd' ;declare @t2 table ( id int , val varchar(20)) insert into @t2 select 2 , 'b' union select 3 , 'b' union select 4 , 'c' ;select * fro</summary><published>2011-10-24T10:32:00Z</published><updated>2011-10-24T10:32:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2011/10/24/2223005.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2011/10/24/2223005.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2011/04/24/2026574.html</id><title type="text">Sql 存储过程 参数传递空字符串， 到SQL 端变成了 空格！！</title><summary type="text">ADO.Net 存储过程传递参数时， 参数值是 空字符串， 但是用 Sql server Profiler 监视时， 发现参数值变成了 空格。经查, 是因为 DbParameter.DbType = DbType.AnsiStringFixedLength 所致.改为 DbType.AnsiString , 即可.</summary><published>2011-04-24T15:25:00Z</published><updated>2011-04-24T15:25:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2011/04/24/2026574.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2011/04/24/2026574.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2011/03/14/1983999.html</id><title type="text">[转]【纠误】NUMBER定义的长度与USER_TAB_COLUMNS视图中DATA_LENGTH内容不符之缘由</title><summary type="text">原文:http://space.itpub.net/519536/viewspace-6234681.疑问出处1）创建测试表Tsec@ora10g&gt; create table t (x number(38));Table created.2）查看表T的描述sec@ora10g&gt; desc t;Name Null? Type------------------------------------- -------- --------------------------X NUMBER(38)3）得到user_tab_columns视图得到DATA_LENGTH字段大小sec@ora1</summary><published>2011-03-14T09:24:00Z</published><updated>2011-03-14T09:24:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2011/03/14/1983999.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2011/03/14/1983999.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2010/12/14/1905482.html</id><title type="text">[转]pipe row的用法, Oracle split 函数写法.</title><summary type="text">关于 pipe row的用法2009/12/30 14:53===========================================================作者: flysky0814(http://flysky0814.itpub.net)发表于:2007.11.28 11:14分类: oracle10g 出处：http://flysky0814.itpub.net/post/35477/419443---------------------------------------------------------------为了让 PL/SQL 函数返回数据的多个行，必</summary><published>2010-12-14T05:58:00Z</published><updated>2010-12-14T05:58:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2010/12/14/1905482.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2010/12/14/1905482.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2010/12/14/1905478.html</id><title type="text">[转]Oracle 数组的学习</title><summary type="text">提叻一个代码段，要人帮助解释一下。 代码段如下： 一段很简单的有关Oracle里数组的sample代码。看着这段由代表性的代码，不由想起自己以前独自摸索Oracle里数组类型的那种不弄明白决不姑息的激情。 这段代码也还不错，通过简单的实例就把主要的数组类型都罗列出来叻，好的素材 不由又激发其我回答写写的欲望叻，所以也不吝指力，总结叻一番，也顺便填补一下我以前忘记归纳总结的空缺 这段代码，收罗叻Oracle里数组的使用方式 1. index by table 2. nested table 3. varray 可变数组 这里是Oracle文档里对这三种数组类型的介绍 An index-by t</summary><published>2010-12-14T05:55:00Z</published><updated>2010-12-14T05:55:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2010/12/14/1905478.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2010/12/14/1905478.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2010/08/18/1802415.html</id><title type="text">Sql的自定义聚合函数，挺费劲。</title><summary type="text">想实现把字符串合并的聚合函数。关键是在视图中不能定义变量(在函数中可以定义变量)。不能进行复杂的多语句操作。但也有解决方案 见： http://www.cnblogs.com/yiyanxiyin/archive/2008/09/28/1230524.html一条语句出结果，挺费劲，我的实现。 [代码]表值函数定义方法：[代码]</summary><published>2010-08-18T07:15:00Z</published><updated>2010-08-18T07:15:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2010/08/18/1802415.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2010/08/18/1802415.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2010/07/26/1785341.html</id><title type="text">Sql2008 Analysis Server 笔记.</title><summary type="text">先想像一个立方体.立方体的每个切面(横切,竖切,斜切)形成一个数据视图. 以 Excel 表格来描述切面数据.1.维度是立方体的每个边,是Excel 行主键指标.2.度量值是Excel该行主键指标下的计划值.3.安装的环境.在 Sql server Business Intelligence Developement Studio 里,建Cube,维度.能调试出视图后, 处理生成到数据库.4.建立...</summary><published>2010-07-26T07:19:00Z</published><updated>2010-07-26T07:19:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2010/07/26/1785341.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2010/07/26/1785341.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2010/06/06/1752584.html</id><title type="text">[转] 绿色Oracle客户端</title><summary type="text">以后不再需要安装oracle客户端了，需要两个dll文件，oci.dll和oraociei11.dll，只要扔到system32文件夹下就可以了。当连接数据库的时候，在Web.Config中的配置改为以下配置就ＯＫ了。&lt;add name="DataAccessQuickStart" providerName="System.Data.OracleClient" connectionStrin...</summary><published>2010-06-06T04:41:00Z</published><updated>2010-06-06T04:41:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2010/06/06/1752584.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2010/06/06/1752584.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2010/06/05/1752133.html</id><title type="text">常识：Oracle 匿名存储过程。返回影响行数。</title><summary type="text">begin update tabname set=111 where ...; dbms_output.put_line(SQL%ROWCOUNT); end; /</summary><published>2010-06-05T02:33:00Z</published><updated>2010-06-05T02:33:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2010/06/05/1752133.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2010/06/05/1752133.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/newsea/archive/2010/06/04/1751224.html</id><title type="text">Oracle 11 客户端连接。</title><summary type="text">如果只安装 Oracle11客户端，连接服务器的话， 服务名可以写： IP/SID但是如果安装了 Oracle11服务器的话， 程序连接就报 12154错误。必须配置 tnsnames.ora 文件。两个现象还有：1.用客户端的SqlPlus连接： username/password@ip/sid 也可以的。 2.用服务器的 SqlPlus连接：报12154错误。我想：Oracle的客户端和服务器...</summary><published>2010-06-04T02:39:00Z</published><updated>2010-06-04T02:39:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2010/06/04/1751224.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2010/06/04/1751224.html"/><content type="text">如果只安装 Oracle11客户端，连接服务器的话， 服务名可以写： IP/SID但是如果安装了 Oracle11服务器的话， 程序连接就报 12154错误。必须配置 tnsnames.ora 文件。两个现象还有：1.用客户端的SqlPlus连接： username/password@ip/sid 也可以的。 2.用服务器的 SqlPlus连接：报12154错误。我想：Oracle的客户端和服务器...</content></entry><entry><id>http://www.cnblogs.com/newsea/archive/2010/05/20/1740207.html</id><title type="text">SQL 找出某列最小的行记录.</title><summary type="text">declare @users table(id int , name varchar(300),sex varchar(10) , age int, addtime datetime) ;insert into @users select 1,'liu','男',30,GETDATE() union select 2 , 'liu','女',30 , GETDATE() union select ...</summary><published>2010-05-20T09:20:00Z</published><updated>2010-05-20T09:20:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2010/05/20/1740207.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2010/05/20/1740207.html"/><content type="text">declare @users table(id int , name varchar(300),sex varchar(10) , age int, addtime datetime) ;insert into @users select 1,'liu','男',30,GETDATE() union select 2 , 'liu','女',30 , GETDATE() union select ...</content></entry><entry><id>http://www.cnblogs.com/newsea/archive/2010/05/14/1735798.html</id><title type="text">再骂MS.</title><summary type="text">MS自己傻B,把用户当傻子.1. Sqlserver2008里,"阻止保存要求重新创建表的更改", 有个屁用,为了安全？！傻B 的MS .2. 还有IE的允许执行脚本。3. Windows2003 更新完之后,无法访问服务器共享. 查资料后, 了解到, 要卸载 Kb968389 补丁. 关于这个补丁的说明: (身份验证的扩展保护)http://support.microsoft.com/?kbid...</summary><published>2010-05-14T13:48:00Z</published><updated>2010-05-14T13:48:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2010/05/14/1735798.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2010/05/14/1735798.html"/><content type="text">MS自己傻B,把用户当傻子.1. Sqlserver2008里,"阻止保存要求重新创建表的更改", 有个屁用,为了安全？！傻B 的MS .2. 还有IE的允许执行脚本。3. Windows2003 更新完之后,无法访问服务器共享. 查资料后, 了解到, 要卸载 Kb968389 补丁. 关于这个补丁的说明: (身份验证的扩展保护)http://support.microsoft.com/?kbid...</content></entry><entry><id>http://www.cnblogs.com/newsea/archive/2009/08/22/1552214.html</id><title type="text">Sql2000分页效率之我见。</title><summary type="text">针对Sql两种分页方法进行详细比对。 方案一：Not In方案二： ID &gt; ( Max(ID) where subquery )</summary><published>2009-08-22T15:28:00Z</published><updated>2009-08-22T15:28:00Z</updated><author><name>NewSea.</name><uri>http://www.cnblogs.com/newsea/</uri></author><link rel="alternate" href="http://www.cnblogs.com/newsea/archive/2009/08/22/1552214.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/newsea/archive/2009/08/22/1552214.html"/><content type="text">针对Sql两种分页方法进行详细比对。 方案一：Not In方案二： ID &gt; ( Max(ID) where subquery )</content></entry></feed>
