⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sql server开发技巧-8.htm

📁 微软数据库开发梦工场多媒体教学-sql server篇.rar,是多媒体教学的
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#000000" text="#FFFFFF">
<p><font color="#00CC00">在select语句中使用top的一些小技巧</font></p>
<p> </p>
<p>It's well-known.Microsoft SQL Server 7.0增加了一个语句top,可以限制返回的记录数。但是在使用的时候,有时候会遇到一些问题。 
  比如希望返回前三名的比分,但是第三名有并列的,使用select top 3 * from table order by score的话就只能返回三条记录,在这样的情况下,就可以使用<br>
  select top 3 with ties * from table order by score<br>
  还有,有的时候我不希望出现重复的记录,那么可以使用select distinct top 3 <br>
  * from table order by score</p>
<p> </p>
<p>如何操作SQL的TXT字段</p>
<p> </p>
<p>1、在从SQL的 TXT字段中获取数据时,不能用缺省的forward-only光标。</p>
<p>2、当大量的插入时,要用 INSERTTEXT 和 UPDATETEXT命令。</p>
<p>以下有例子:</p>
<p>&lt;!-- #INCLUDE VIRTUAL=&quot;adovbs.inc&quot; --&gt;</p>
<p>&lt;%</p>
<p>Set MyCon=Server.CreateObject(&quot;ADODB.Connection&quot;)</p>
<p>Set RS=Server.CreateObject(&quot;ADODB.RecordSet&quot;)</p>
<p>MyCon.Open &quot;DSN=MyDSN;UID=ME;PWD=Secret&quot;</p>
<p>' Create a SQL Insert String</p>
<p>MySQL=&quot;INSERT MyTable (MyTextColumn) VALUES ('Some really long <br>
  string')&quot;</p>
<p>' Insert the string into the table named &quot;MyTable&quot;</p>
<p>MyCon.Execute MySQL</p>
<p>' Open the RecordSet with a Static Cursor for a TEXT Column</p>
<p>RS.Open &quot;SELECT MyTextColumn FROM MyTable&quot;,MyCon,adOpenStatic</p>
<p>Response.Write(RS(&quot;MyTextColumn&quot;))</p>
<p>RS.Close</p>
<p>MyCon.Close</p>
<p>%&gt;<br>
</p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -