﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-奋斗属于认真者!</title><link>http://www.cnitblog.com/szgjy/</link><description>相信自己,你行!你最棒!</description><language>zh-cn</language><lastBuildDate>Wed, 29 Apr 2026 06:01:23 GMT</lastBuildDate><pubDate>Wed, 29 Apr 2026 06:01:23 GMT</pubDate><ttl>60</ttl><item><title>ASP.NET数据绑定(上) [转载]</title><link>http://www.cnitblog.com/szgjy/archive/2008/10/16/50329.html</link><dc:creator>IT人才</dc:creator><author>IT人才</author><pubDate>Thu, 16 Oct 2008 11:37:00 GMT</pubDate><guid>http://www.cnitblog.com/szgjy/archive/2008/10/16/50329.html</guid><wfw:comment>http://www.cnitblog.com/szgjy/comments/50329.html</wfw:comment><comments>http://www.cnitblog.com/szgjy/archive/2008/10/16/50329.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/szgjy/comments/commentRss/50329.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/szgjy/services/trackbacks/50329.html</trackback:ping><description><![CDATA[<p>&nbsp;</p>
<p><a href="http://www.cnblogs.com/hjf1223/archive/2008/05/03/digging_into_binding_expression_1.html">http://www.cnblogs.com/hjf1223/archive/2008/05/03/digging_into_binding_expression_1.html</a></p>
<br>
<img src ="http://www.cnitblog.com/szgjy/aggbug/50329.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/szgjy/" target="_blank">IT人才</a> 2008-10-16 19:37 <a href="http://www.cnitblog.com/szgjy/archive/2008/10/16/50329.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于pL/sql和T-sql的区别</title><link>http://www.cnitblog.com/szgjy/archive/2008/10/16/50326.html</link><dc:creator>IT人才</dc:creator><author>IT人才</author><pubDate>Thu, 16 Oct 2008 11:03:00 GMT</pubDate><guid>http://www.cnitblog.com/szgjy/archive/2008/10/16/50326.html</guid><wfw:comment>http://www.cnitblog.com/szgjy/comments/50326.html</wfw:comment><comments>http://www.cnitblog.com/szgjy/archive/2008/10/16/50326.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/szgjy/comments/commentRss/50326.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/szgjy/services/trackbacks/50326.html</trackback:ping><description><![CDATA[1、外连接 &nbsp; <br>&nbsp; &#183;MS &nbsp; SQL &nbsp; SERVER &nbsp; 支持两种形式表间连接 &nbsp; <br>&nbsp; ①从Sybase继承来的形式： &nbsp; <br>&nbsp; 字段1 &nbsp; *= &nbsp; 字段2 &nbsp; （左连接） &nbsp; <br>&nbsp; 字段1 &nbsp; =* &nbsp; 字段2 &nbsp; （右连接） &nbsp; <br>&nbsp; 没有这种形式的全外连接语法 &nbsp; <br>&nbsp; ②标准的外连接语法 &nbsp; <br>&nbsp; left &nbsp; [outer] &nbsp; join &nbsp; on &nbsp; 逻辑表达式 &nbsp; <br>&nbsp; &nbsp; &nbsp; right &nbsp; [outer] &nbsp; join &nbsp; on &nbsp; 逻辑表达式 &nbsp; <br>&nbsp; full &nbsp; [outer] &nbsp; join &nbsp; (全外连接) &nbsp; on &nbsp; 逻辑表达式 &nbsp; <br>&nbsp; 这里的逻辑表达式 &nbsp; 可以是很复杂的表达式例如 &nbsp; ：A.ID=B.ID &nbsp; AND &nbsp; (A.Parebt_ID=1 &nbsp; OR &nbsp; A.Parent_ID=2) &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; 需要提醒大家的是：你写的查询语句报告过这样的错误 &nbsp; &nbsp; <br>&nbsp; &nbsp; Joined &nbsp; tables &nbsp; cannot &nbsp; be &nbsp; specified &nbsp; in &nbsp; a &nbsp; query &nbsp; containing &nbsp; outer &nbsp; join &nbsp; operators. &nbsp; Joined &nbsp; tables &nbsp; cannot &nbsp; be &nbsp; specified &nbsp; in &nbsp; a &nbsp; query &nbsp; containing &nbsp; outer &nbsp; join &nbsp; operators. &nbsp; View &nbsp; or &nbsp; function &nbsp; 'dbo.VU_CAF_BILLS' &nbsp; contains &nbsp; joined &nbsp; tables &nbsp; <br>&nbsp; 这句话告诉你，你查询语句引用的视图或者子查询也用到了外连接，但是引用视图或者子查询外连接语法与你的外连接语法不一直导致的 &nbsp; <br>&nbsp; &nbsp; 例如：select &nbsp; A.[ZONE],A.FLAG,A.FlagDesc,A.CAF_NO &nbsp; <br>&nbsp; &nbsp; &nbsp; from &nbsp; dbo.VU_CAF_BILLS &nbsp; A,TU_Flag &nbsp; <br>&nbsp; &nbsp; &nbsp; where &nbsp; A.CAF_NO*=TU_Flag.ObjNo &nbsp; <br>&nbsp; &nbsp; 视图dbo.VU_CAF_BILLS的外连接语法是标准的SQL语法，而本语句中的外连接语法却是Sybase式的外连接语法。 &nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &#183;Oracle不支持标准的外连接语法，也没有全外连接，这是它的缺陷 &nbsp; <br>&nbsp; &nbsp; 字段1 &nbsp; = &nbsp; 字段2(+) &nbsp; （左连接） &nbsp; <br>&nbsp; 字段1(+) &nbsp; = &nbsp; 字段2 &nbsp; （右连接） &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &#183;使用外连接语句的用处 &nbsp; <br>&nbsp; ①不想因为表连接而使主表数据行丢失，这一点毋庸多说 &nbsp; <br>&nbsp; ①找某条记录在A表存在，而在B表不存在，按常规做法使用not &nbsp; in &nbsp; （select &nbsp; 查询子句）语法， &nbsp; <br>&nbsp; 使用not &nbsp; in &nbsp; 最大的缺点速度慢，原因是每个数据行都去做：select &nbsp; 查询子句 &nbsp; <br>&nbsp; 而使用下面的语法： &nbsp; <br>&nbsp; &nbsp; select &nbsp; TU_COMPANY.* &nbsp; <br>&nbsp; &nbsp; from &nbsp; TU_COMPANY &nbsp; left &nbsp; join &nbsp; TU_Comp_Agent &nbsp; on &nbsp; TU_COMPANY.ID=TU_Comp_Agent.CompCode &nbsp; <br>&nbsp; &nbsp; where &nbsp; TU_Comp_Agent.Id &nbsp; is &nbsp; null &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; 2、触发器 &nbsp; <br>&nbsp; &#183;从我了解到的，MS &nbsp; SQL &nbsp; SERVER,仅有表的触发器，而且触发时机不够丰富 &nbsp; <br>&nbsp; 如插入触发在子，不区分单条插入还是多条插入，也不区分插入前触发还是插入后触发 &nbsp; <br>&nbsp; 碰到多条数据的插入，需要使用游标处理每条插入的数据 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &#183;Oracle提供的触发器不仅有基于表的触发器，而且其他类型的，例如数据库级的触发器：数据库启动、数据库关闭 &nbsp; <br>&nbsp; 对于表级的触发器，区分单条插入还是多条插入，也区分插入前触发还是插入后触发 &nbsp; <br>&nbsp; &nbsp; &nbsp; <br>&nbsp; 3、表数据复制 &nbsp; <br>&nbsp; &#183;库内数据复制 &nbsp; <br>&nbsp; &nbsp; &#183;MS &nbsp; SQL &nbsp; Server &nbsp; &nbsp; <br>&nbsp; Insert &nbsp; into &nbsp; 复制表名称 &nbsp; select &nbsp; 语句 &nbsp; （复制表已经存在） &nbsp; <br>&nbsp; &nbsp; &nbsp; select &nbsp; 字段列表 &nbsp; into &nbsp; 复制表名称 &nbsp; from &nbsp; 表 &nbsp; （复制表不存在） &nbsp; <br>&nbsp; &nbsp; &#183;Oracle &nbsp; <br>&nbsp; &nbsp; &nbsp; Insert &nbsp; into &nbsp; 复制表名称 &nbsp; select &nbsp; 语句 &nbsp; （复制表已经存在） &nbsp; <br>&nbsp; &nbsp; &nbsp; create &nbsp; table &nbsp; 复制表名称 &nbsp; as &nbsp; select &nbsp; 语句 &nbsp; （复制表不存在） &nbsp; <br>&nbsp; &nbsp; &nbsp; <br>&nbsp; &#183;文本文件转入、转出的批量处理 &nbsp; <br>&nbsp; &#183;MS &nbsp; SQL &nbsp; Server &nbsp; &nbsp; <br>&nbsp; BCP命令行程序 &nbsp; <br>&nbsp; &#183;Oracle &nbsp; <br>&nbsp; &nbsp; &nbsp; SQLLDR命令行程序 &nbsp; <br>&nbsp; 4、多表更新、删除 &nbsp; <br>&nbsp; 一条更新语句是不能更新多张表的，除非使用触发器隐含更新，我这里说的意思是：根据其他表数据更新你要更新的表 &nbsp; <br>&nbsp; 一般形式： &nbsp; <br>&nbsp; &#183;MS &nbsp; SQL &nbsp; Server &nbsp; &nbsp; <br>&nbsp; &nbsp; update &nbsp; A &nbsp; <br>&nbsp; &nbsp; SET &nbsp; 字段1=B表字段表达式, &nbsp; <br>&nbsp; &nbsp; &nbsp; 字段2=B表字段表达式 &nbsp; <br>&nbsp; from &nbsp; B &nbsp; &nbsp; <br>&nbsp; WHERE &nbsp; 逻辑表达式 &nbsp; <br>&nbsp; &#183;Oracle &nbsp; <br>&nbsp; &nbsp; update &nbsp; A &nbsp; <br>&nbsp; &nbsp; SET &nbsp; 字段1=（select &nbsp; 字段表达式 &nbsp; from &nbsp; B &nbsp; WHERE &nbsp; ...）, &nbsp; <br>&nbsp; &nbsp; &nbsp; 字段2=（select &nbsp; 字段表达式 &nbsp; from &nbsp; B &nbsp; WHERE &nbsp; ...） &nbsp; <br>&nbsp; WHERE &nbsp; 逻辑表达式 &nbsp; <br>&nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; 从以上来看，感觉oracle没有ms &nbsp; sql好，主要原因：假如A需要多个字段更新，MS_SQL语句更简练 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; 你知道刚学数据库的人怎么做上面这件事情吗，他们使用游标一条一条的处理 &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; 5、关于存储过程或函数中使用的临时表，两者都提供了这个功能 &nbsp; <br>&nbsp; 临时表，最主要的好处是，操作不留任何痕迹、不产生日志， &nbsp; <br>&nbsp; 所以速度快 &nbsp; <br>&nbsp; &nbsp; &#183;MS &nbsp; SQL &nbsp; SERVER &nbsp; <br>&nbsp; &nbsp; &nbsp; CREATE &nbsp; TABLE &nbsp; #表名称（........） &nbsp; 或者 &nbsp; SELECT &nbsp; 字段表达式列表 &nbsp; INTO &nbsp; #表名称 &nbsp; FROM &nbsp; <br>&nbsp; &nbsp; &nbsp; 表名称前加#即可，这些临时表都是只在一个数据库连接会话期间有效 &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; &#183;Oracle &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; create &nbsp; [Global] &nbsp; Temporary &nbsp; Table &nbsp; ,加上[Global]就是全局的临时表（所有数据库连接会话都是可见的）， &nbsp; <br>&nbsp; &nbsp; &nbsp; 不则为私有的（在一个数据库连接会话期间有效） &nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; &nbsp; <br>&nbsp; 6、动态执行SQL语句 &nbsp; <br>&nbsp; &nbsp; &#183;MS &nbsp; SQL &nbsp; SERVER &nbsp; 7.0好象没有这个功能，MS &nbsp; SQL &nbsp; SERVER &nbsp; 2000已经这个功能。 &nbsp; <br>&nbsp; &nbsp; &nbsp; 你是不是想在存储过程的参数中传递一个表名或者在过程体里动态 &nbsp; <br>&nbsp; &nbsp; &nbsp; 生成一个SQL语句，你会发现很难办到。看了下面的例子：你以前的问题全解决了 &nbsp; <br>&nbsp; &nbsp; &nbsp; declare &nbsp; @count &nbsp; int &nbsp; <br>&nbsp; &nbsp; &nbsp; declare &nbsp; @SQL &nbsp; nvarchar(200) &nbsp; <br>&nbsp; &nbsp; &nbsp; set &nbsp; @SQL &nbsp; = &nbsp; N'select &nbsp; count(*) &nbsp; from &nbsp; sysobjects' &nbsp; <br>&nbsp; &nbsp; &nbsp; exec &nbsp; sp_executesql &nbsp; @SQL,N'@i &nbsp; int &nbsp; output',@count &nbsp; output &nbsp; <br>&nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &nbsp; <br>&nbsp; &#183;Oracle提供了两种方法实现这个功能 &nbsp; <br>&nbsp; &nbsp; &nbsp; ①程序包DBMS_SQL，执行一个语句的过程： &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; 打开游标（open_cursor，对于非查询语句，无此过程） &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; 分析语句（Parse) &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; 绑定变量（bind_variable） &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; 执行语句（execute) &nbsp; <br>&nbsp; &nbsp; &nbsp; &nbsp; 关闭游标（close_cursor,对于非查询语句，无此过程) &nbsp; <br>&nbsp; &nbsp; &nbsp; ②execute &nbsp; immediate &nbsp; ls_SQL&nbsp;&nbsp; <br>
<img src ="http://www.cnitblog.com/szgjy/aggbug/50326.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/szgjy/" target="_blank">IT人才</a> 2008-10-16 19:03 <a href="http://www.cnitblog.com/szgjy/archive/2008/10/16/50326.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>