亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch13.htm

?? Learn SQL in an easy way...
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT">7</TD>		<TD ALIGN="LEFT">5</TD>		<TD ALIGN="LEFT">Come On, Come On</TD>		<TD ALIGN="LEFT">1992</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT">7</TD>		<TD ALIGN="LEFT">3</TD>		<TD ALIGN="LEFT">Stones in the Road</TD>		<TD ALIGN="LEFT">1994</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT">8</TD>		<TD ALIGN="LEFT">5</TD>		<TD ALIGN="LEFT">Second Piano Concerto</TD>		<TD ALIGN="LEFT">1985</TD>	</TR></TABLE><H4><FONT COLOR="#000077">Example 13.1</FONT></H4><P>You can create a temporary table in the <TT>tempdb</TT> database. After insertinga dummy record into this table, log out. After logging back into SQL Server, tryto select the dummy record out of the temporary table. Note the results:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">1&gt; <B>create table #albums (</B>2&gt; <B>artist char(30),</B>3&gt; <B>album_name char(50),</B>4&gt;<B> media_type int)</B>5&gt; <B>go</B>1&gt; <B>insert #albums values (&quot;The Replacements&quot;, &quot;Pleased To Meet Me&quot;, 1)</B>2&gt; <B>go</B></FONT></PRE><P>Now log out of the SQL Server connection using the <TT>EXIT</TT> (or <TT>QUIT</TT>)command. After logging back in and switching to the database you last used, try thefollowing command:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">1&gt; select * from #albums2&gt; go</FONT></PRE><H5>ANALYSIS:</H5><P>This table does not exist in the current database.<H4><FONT COLOR="#000077">Example 13.2</FONT></H4><P>Now create the table with syntax 2:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">1&gt; <B>create table tempdb..albums (</B>2&gt; <B>artist char(30)</B>,3&gt; <B>album_name char(50),</B>4&gt; <B>media_type int)</B>5&gt;<B> go</B>1&gt; <B>insert #albums values (&quot;The Replacements&quot;, &quot;Pleased To Meet Me&quot;, 1)</B>2&gt; <B>go</B></FONT></PRE><P>After logging out and logging back in, switch to the database you were using when<TT>create table tempdb..albums()</TT> was issued; then issue the following command:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">1&gt; <B>select * from #albums</B>2&gt;<B> go</B></FONT></PRE><P>This time, you get the following results:</P><H5>OUTPUT:</H5><PRE><FONT COLOR="#0066FF">artist                         album_name              media_type_______________________________________________________________________________________</FONT></PRE><PRE><FONT COLOR="#0066FF">The Replacements               Pleased To Meet Me      1</FONT></PRE><H4><FONT COLOR="#000077">Example 13.3</FONT></H4><P>This example shows a common usage of temporary tables: to store the results ofcomplex queries for use in later queries.</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">1&gt; <B>create table #temp_info (</B>2&gt; <B>name char(30),</B>3&gt; <B>homebase char(40),</B>4&gt; <B>style char(20),</B>5&gt; <B>artist_id int)</B>6&gt; <B>insert #temp_info</B>7&gt; <B>select * from ARTISTS where homebase = &quot;Nashville&quot;</B>8&gt; <B>select RECORDINGS.* from RECORDINGS, ARTISTS</B>9&gt; <B>where RECORDINGS.artist_id = #temp_info.artist_id</B>10&gt;<B> go</B></FONT></PRE><P>The preceding batch of commands selects out the recording information for allthe artists whose home base is Nashville.</P><P>The following command is another way to write the set of SQL statements used inExample 13.3:</P><PRE><FONT COLOR="#0066FF">1&gt;<B> select ARTISTS.* from ARTISTS, RECORDINGS where ARTISTS.homebase = &quot;Nashville&quot;</B>2&gt; <B>go</B></FONT></PRE><H2><FONT COLOR="#000077">Cursors</FONT></H2><P>A database cursor is similar to the cursor on a word processor screen. As youpress the Down Arrow key, the cursor scrolls down through the text one line at atime. Pressing the Up Arrow key scrolls your cursor up one line at a time. Hittingother keys such as Page Up and Page Down results in a leap of several lines in eitherdirection. Database cursors operate in the same way.</P><P>Database cursors enable you to select a group of data, scroll through the groupof records (often called a recordset), and examine each individual line of data asthe cursor points to it. You can use a combination of local variables and a cursorto individually examine each record and perform any external operation needed beforemoving on to the next record.</P><P>One other common use of cursors is to save a query's results for later use. Acursor's result set is created from the result set of a <TT>SELECT</TT> query. Ifyour application or procedure requires the repeated use of a set of records, it isfaster to create a cursor once and reuse it several times than to repeatedly querythe database. (And you have the added advantage of being able to scroll through thequery's result set with a cursor.)</P><P>Follow these steps to create, use, and close a database cursor:<DL>	<DD><B>1.</B> Create the cursor.	<P><B>2. </B>Open the cursor for use within the procedure or application.</P>	<P><B>3.</B> Fetch a record's data one row at a time until you have reached the end	of the cursor's records.</P>	<P><B>4.</B> Close the cursor when you are finished with it.</P>	<P><B>5. </B>Deallocate the cursor to completely discard it.</DL><H3><FONT COLOR="#000077">Creating a Cursor</FONT></H3><P>To create a cursor using Transact-SQL, issue the following syntax:</P><H5>SYNTAX:</H5><PRE><FONT COLOR="#0066FF">declare cursor_name cursor     for select_statement     [for {read only | update [of column_name_list]}]</FONT></PRE><P>The Oracle7 SQL syntax used to create a cursor looks like this:</P><H5>SYNTAX:</H5><PRE><FONT COLOR="#0066FF">DECLARE cursor_name CURSOR     FOR {SELECT command | statement_name | block_name}</FONT></PRE><P>By executing the <TT>DECLARE cursor_name CURSOR</TT> statement, you have definedthe cursor result set that will be used for all your cursor operations. A cursorhas two important parts: the cursor result set and the cursor position.</P><P>The following statement creates a cursor based on the <TT>ARTISTS</TT> table:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">1&gt; <B>create Artists_Cursor cursor</B>2&gt; <B>for select * from ARTISTS</B>3&gt; <B>go</B></FONT></PRE><H5>ANALYSIS:</H5><P>You now have a simple cursor object named <TT>Artists_Cursor</TT> that containsall the records in the <TT>ARTISTS</TT> table. But first you must open the cursor.<H3><FONT COLOR="#000077">Opening a Cursor</FONT></H3><P>The simple command to open a cursor for use is</P><H5>SYNTAX:</H5><PRE><FONT COLOR="#0066FF">open cursor_name</FONT></PRE><P>Executing the following statement opens <TT>Artists_Cursor</TT> for use:</P><PRE><FONT COLOR="#0066FF">1&gt; <B>open Artists_Cursor</B>2&gt;<B> go</B></FONT></PRE><P>Now you can use the cursor to scroll through the result set.<H3><FONT COLOR="#000077">Scrolling a Cursor</FONT></H3><P>To scroll through the cursor's result set, Transact-SQL provides the following<TT>FETCH</TT> command.</P><H5>SYNTAX:</H5><PRE><FONT COLOR="#0066FF">fetch cursor_name [into fetch_target_list]</FONT></PRE><P>Oracle SQL provides the following syntax:</P><PRE><FONT COLOR="#0066FF">FETCH cursor_name {INTO : host_variable     [[INDICATOR] : indicator_variable]        [,   : host_variable        [[INDICATOR] : indicator_variable] ]...     | USING DESCRIPTOR descriptor }</FONT></PRE><P>Each time the <TT>FETCH</TT> command is executed, the cursor pointer advancesthrough the result set one row at a time. If desired, data from each row can be fetchedinto the<TT> fetch_target_list</TT> variables.<BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>Transact-SQL enables the programmer	to advance more than one row at a time by using the following command: <TT>set cursor	rows </TT>number<TT> for cursor_name</TT>. This command cannot be used with the <TT>INTO</TT>	clause, however. It is useful only to jump forward a known number of rows instead	of repeatedly executing the <TT>FETCH</TT> statement. <HR></BLOCKQUOTE><P>The following statements fetch the data from the<TT> Artists_Cursor</TT> resultset and return the data to the program variables:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">1&gt; <B>declare @name char(30)</B>2&gt; <B>declare @homebase char(40)</B>3&gt; <B>declare @style char(20)</B>4&gt; <B>declare @artist_id int</B>5&gt; <B>fetch Artists_Cursor into @name, @homebase, @style, @artist_id</B>6&gt; <B>print @name</B>7&gt; <B>print @homebase</B>8&gt; <B>print @style</B>9&gt; <B>print char(@artist_id)</B>10&gt; <B>go</B></FONT></PRE><P>You can use the <TT>WHILE</TT> loop (see Day 12, &quot;Database Security&quot;)to loop through the entire result set. But how do you know when you have reachedthe end of the records?<H3><FONT COLOR="#000077">Testing a Cursor's Status</FONT></H3><P>Transact-SQL enables you to check the status of the cursor at any time throughthe maintenance of two global variables: <TT>@@sqlstatus</TT> and <TT>@@rowcount</TT>.</P><P>The <TT>@@sqlstatus</TT> variable returns status information concerning the lastexecuted <TT>FETCH</TT> statement. (The Transact-SQL documentation states that nocommand other than the <TT>FETCH</TT> statement can modify the <TT>@@sqlstatus</TT>variable.) This variable contains one of three values. The following table appearsin the Transact-SQL reference manuals: <BR><BR><TABLE BORDER="1">	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP">Status</TD>		<TD ALIGN="LEFT" VALIGN="TOP">Meaning</TD>	</TR>	<TR>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>0</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">Successful completion of the <TT>FETCH</TT> statement.</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>1</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">The <TT>FETCH</TT> statement resulted in an error.</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>2</TT></TD>		<TD VALIGN="TOP">There is no more data in the result set.</TD>	</TR></TABLE><DL>	<DD></DL><P>The <TT>@@rowcount</TT> variable contains the number of rows returned from thecursor's result set up to the previous fetch. You can use this number to determinethe number of records in a cursor's result set.</P><P>The following code extends the statements executed during the discussion of the<TT>FETCH</TT> statement. You now use the <TT>WHILE</TT> loop with the <TT>@@sqlstatus</TT>variable to scroll the cursor:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">1&gt; <B>declare @name char(30)</B>2&gt; <B>declare @homebase char(40)</B>3&gt;<B> declare @style char(20)</B>4&gt; <B>declare @artist_id int</B>5&gt; <B>fetch Artists_Cursor into @name, @homebase, @style, @artist_id</B>6&gt; <B>while (@@sqlstatus = 0)</B>7&gt; <B>begin</B>8&gt;    <B>  print @name</B>9&gt;      <B>print @homebase</B>10&gt;     <B>print @style</B>11&gt;    <B> print char(@artist_id)</B>12&gt;     <B>fetch Artists_Cursor into @name, @homebase, @style, @artist_id</B>13&gt; <B>end</B>14&gt; <B>go</B></FONT></PRE><H5>ANALYSIS:</H5><P>Now you have a fully functioning cursor! The only step left is to close the cursor.<H3><FONT COLOR="#000077">Closing a Cursor</FONT></H3><P>Closing a cursor is a very simple matter. The statement to close a cursor is asfollows:</P><H5>SYNTAX:</H5><PRE><FONT COLOR="#0066FF">close cursor_name</FONT></PRE><P>This cursor still exists; however, it must be reopened. Closing a cursor essentiallycloses out its result set, not its entire existence. When you are completely finishedwith a cursor, the <TT>DEALLOCATE</TT> command frees the memory associated with acursor and frees the cursor name for reuse. The <TT>DEALLOCATE</TT> statement syntaxis as follows:</P><H5>SYNTAX:</H5><PRE><FONT COLOR="#0066FF">deallocate cursor cursor_name</FONT></PRE><P>Example 13.4 illustrates the complete process of creating a cursor, using it,and then closing it, using Transact-SQL.<H4><FONT COLOR="#000077">Example 13.4</FONT></H4><H5><FONT COLOR="#000000">INPUT:</FONT></H5><PRE><FONT COLOR="#0066FF">1&gt; <B>declare @name char(30)</B>2&gt; <B>declare @homebase char(40)</B>3&gt; <B>declare @style char(20)</B>4&gt; <B>declare @artist_id int</B>5&gt; <B>create Artists_Cursor cursor</B>6&gt; <B>for select * from ARTISTS</B>7&gt; <B>open Artists_Cursor</B>8&gt; <B>fetch Artists_Cursor into @name, @homebase, @style, @artist_id</B>9&gt; <B>while (@@sqlstatus = 0)</B>10&gt; <B>begin</B>11&gt;      <B>print @name</B>12&gt;     <B> print @homebase</B>13&gt;    <B>  print @style</B>14&gt;     <B> print char(@artist_id)</B>15&gt;    <B>  fetch Artists_Cursor into @name, @homebase, @style, @artist_id</B>16&gt; <B>end</B>17&gt; <B>close Artists_Cursor</B>18&gt; <B>deallocate cursor Artists_Cursor</B>19&gt; <B>go</B></FONT></PRE><BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>The following is sample data only.	<HR></P></BLOCKQUOTE><H5>OUTPUT:</H5><PRE><FONT COLOR="#0066FF">Soul Asylum             Minneapolis        Rock        1Maurice Ravel           France             Classical   2Dave Matthews Band      Charlottesville    Rock        3Vince Gill              Nashville          Country     4Oingo Boingo            Los Angeles        Pop         5Crowded House           New Zealand        Pop         6Mary Chapin-Carpenter   Nashville          Country     7Edward MacDowell        U.S.A.             Classical   8</FONT></PRE><H3><FONT COLOR="#000077">The Scope of Cursors</FONT></H3><P>Unlike tables, indexes, and other objects such as triggers and stored procedures,cursors do not exist as database objects after they are created. Instead, cursorshave a limited scope of use.<BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>WARNING:</B></FONT><B> </B>Remember, however, that memory	remains allocated for the cursor, even though its name may no longer exist. Before	going outside the cursor's scope, the cursor should always be closed and deallocated.	<HR></BLOCKQUOTE><P>A cursor can be created within three regions:<UL>	<LI>In a session--A session begins when a user logs on. If the user logged on to	an SQL Server and then created a cursor, then cursor_name would exist until the user	logged off. The user would not be able to reuse cursor_name during the current session.	<P>	<LI>Stored procedure--A cursor created inside a stored procedure is good only during	the execution of the stored procedure. As soon as the stored procedure exits, <TT>cursor_name</TT>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产午夜精品久久| 91精品国产综合久久精品麻豆| 久久免费午夜影院| 国产一区二区0| 国产精品色哟哟| a级精品国产片在线观看| 一区二区不卡在线播放 | 免费看日韩a级影片| 日韩一区二区三| 韩国精品一区二区| 国产精品久久久久久久久免费丝袜| 99vv1com这只有精品| 亚洲成人你懂的| 久久一夜天堂av一区二区三区| 成人av中文字幕| 天天综合色天天综合| 久久久一区二区三区| 一本色道**综合亚洲精品蜜桃冫| 日韩国产欧美三级| 亚洲国产精品ⅴa在线观看| 欧美中文字幕久久| 国产乱码精品1区2区3区| 亚洲美女屁股眼交3| 欧美精品在线一区二区| 国产999精品久久久久久绿帽| 一区二区欧美视频| 久久中文娱乐网| 欧美日韩三级在线| www.激情成人| 美女脱光内衣内裤视频久久网站 | 亚洲一区二区欧美| 51精品秘密在线观看| 国产91在线观看丝袜| 婷婷亚洲久悠悠色悠在线播放| 久久亚洲一区二区三区明星换脸| 日本福利一区二区| 国产精品亚洲一区二区三区妖精| 亚洲bdsm女犯bdsm网站| 国产精品久久久久久亚洲毛片| 欧美一区二区三区不卡| 99久久综合国产精品| 九一久久久久久| 亚洲影院在线观看| 中文字幕av一区二区三区免费看| 欧美久久久影院| 97久久精品人人做人人爽50路| 免费在线一区观看| 亚洲福利一区二区| 亚洲人xxxx| 日韩精品欧美精品| 亚洲精品一区二区三区蜜桃下载 | 色婷婷久久99综合精品jk白丝| 国产毛片精品视频| 美女网站色91| 天堂va蜜桃一区二区三区漫画版 | 欧美老年两性高潮| 色综合中文字幕| jiyouzz国产精品久久| 国产一区二区日韩精品| 蜜臀av一区二区三区| 天堂va蜜桃一区二区三区漫画版| 亚洲精品中文在线观看| 国产精品久久久久久久久免费樱桃 | 久久久久国产精品人| 欧美不卡激情三级在线观看| 欧美日本一区二区在线观看| 色域天天综合网| 日本韩国欧美在线| 日本伦理一区二区| 在线影视一区二区三区| 色噜噜偷拍精品综合在线| 99在线视频精品| 99久久精品国产导航| 91在线观看美女| 99国产精品久久久久久久久久久| 本田岬高潮一区二区三区| 成人午夜在线播放| 91免费看`日韩一区二区| 92精品国产成人观看免费| 成人av在线影院| 一本色道久久综合亚洲aⅴ蜜桃| 91色|porny| 色婷婷精品大视频在线蜜桃视频| 色婷婷亚洲综合| 欧美日韩黄色影视| 欧美一区二区黄| 久久精品亚洲麻豆av一区二区 | 色伊人久久综合中文字幕| 色综合天天在线| 欧美偷拍一区二区| 91精品国产综合久久婷婷香蕉| 日韩美女视频在线| 久久精品人人做| 1区2区3区国产精品| 亚洲国产成人av| 久久爱www久久做| 成人av在线播放网址| 欧美中文字幕亚洲一区二区va在线| 欧美日韩免费一区二区三区| 日韩午夜激情电影| 国产精品久久夜| 亚洲成年人影院| 国产一二精品视频| 在线观看91视频| 精品成人私密视频| 亚洲婷婷在线视频| 日av在线不卡| gogo大胆日本视频一区| 欧美妇女性影城| 欧美激情综合网| 日本中文字幕一区二区视频| 国产成人在线观看免费网站| 一本色道a无线码一区v| 日韩视频一区二区三区| 综合精品久久久| 韩日精品视频一区| 日本精品一区二区三区高清| 日韩视频免费观看高清完整版在线观看| 日本一区二区在线不卡| 五月综合激情网| 99久久婷婷国产综合精品| 欧美成人性战久久| 亚洲一区二区三区四区五区中文| 久久se精品一区精品二区| 在线精品视频一区二区三四 | 中文字幕不卡在线播放| 七七婷婷婷婷精品国产| 91麻豆精品秘密| 国产亚洲一区二区三区在线观看 | 欧美激情一区二区三区蜜桃视频| 午夜精品视频在线观看| 99精品欧美一区| 久久久www成人免费无遮挡大片| 亚洲成人一区二区在线观看| jizz一区二区| 国产欧美一区二区三区在线老狼| 人人狠狠综合久久亚洲| 欧美性大战久久| 自拍偷拍亚洲综合| 国产露脸91国语对白| 91精品国产色综合久久不卡蜜臀 | 久久久久久久网| 五月婷婷久久丁香| 在线免费视频一区二区| 中文字幕制服丝袜成人av| 国产一区二区伦理片| 日韩欧美在线综合网| 日本午夜一区二区| 欧美绝品在线观看成人午夜影视| 玉米视频成人免费看| gogogo免费视频观看亚洲一| 欧美国产一区二区| 一区二区三区日韩欧美| 91最新地址在线播放| 亚洲欧洲精品天堂一级| 国产91精品一区二区| 久久九九国产精品| 国产盗摄女厕一区二区三区| 精品国产三级电影在线观看| 捆绑调教一区二区三区| 日韩美一区二区三区| 美女视频黄a大片欧美| 欧美一级搡bbbb搡bbbb| 日本欧美大码aⅴ在线播放| 91精品国产色综合久久不卡电影| 性做久久久久久免费观看 | 亚洲精品在线一区二区| 久久福利资源站| 欧美mv和日韩mv国产网站| 韩国精品主播一区二区在线观看| 欧美精品一区二区三区蜜桃 | eeuss鲁片一区二区三区在线观看| 国产精品毛片大码女人| 91香蕉视频污| 亚洲第一二三四区| 日韩一区二区三区视频| 黄色资源网久久资源365| 国产日产欧产精品推荐色| 成人性生交大片免费看视频在线| 亚洲天堂免费在线观看视频| 欧美性欧美巨大黑白大战| 日本美女视频一区二区| 久久精品一级爱片| 色婷婷狠狠综合| 日韩精品每日更新| 久久综合成人精品亚洲另类欧美 | 国产精品欧美一级免费| 色婷婷综合久久久| 裸体歌舞表演一区二区| 国产欧美日韩视频在线观看| www.av亚洲| 日韩中文字幕区一区有砖一区| 日韩精品专区在线影院重磅| 国产福利91精品一区二区三区| 亚洲青青青在线视频| 91麻豆精品国产91久久久久久久久 | 日韩理论片一区二区| 337p亚洲精品色噜噜| 东方欧美亚洲色图在线| 一区二区三区国产|