SQLSERVERÓα꼰ѻ·Óï¾ä
ÕûÀíһϣ¬¹ØÓÚÓα꣬MSDNÓУº
¹ý Transact-SQL ·þÎñÆ÷Óαê¼ìË÷Ìض¨ÐС£
Transact-SQL Óï·¨Ô¼¶¨
²ÎÊý
NEXT
½ô¸úµ±Ç°Ðзµ»Ø½á¹ûÐУ¬²¢ÇÒµ±Ç°ÐеÝÔöΪ·µ»ØÐС£Èç¹û FETCH NEXT Ϊ¶ÔÓαêµÄµÚÒ»´ÎÌáÈ¡²Ù×÷£¬Ôò·µ»Ø½á¹û¼¯ÖеĵÚÒ»ÐС£NEXT ΪĬÈϵÄÓαêÌáÈ¡Ñ¡Ïî¡£
PRIOR
·µ»Ø½ôÁÚµ±Ç°ÐÐÇ°ÃæµÄ½á¹ûÐУ¬²¢ÇÒµ±Ç°ÐеݼõΪ·µ»ØÐС£Èç¹û FETCH PRIOR Ϊ¶ÔÓαêµÄµÚÒ»´ÎÌáÈ¡²Ù×÷£¬ÔòûÓÐÐзµ»Ø²¢ÇÒÓαêÖÃÓÚµÚÒ»ÐÐ֮ǰ¡£
FIRST
·µ»ØÓαêÖеĵÚÒ»Ðв¢½«Æä×÷Ϊµ±Ç°ÐС£
LAST
·µ»ØÓαêÖеÄ×îºóÒ»Ðв¢½«Æä×÷Ϊµ±Ç°ÐС£
ABSOLUTE { n | @nvar}
Èç¹û n »ò @nvar ΪÕý£¬Ôò·µ»Ø´ÓÓαêÍ·¿ªÊ¼ÏòºóµÄµÚ n ÐУ¬²¢½«·µ»ØÐбä³Éеĵ±Ç°ÐС£Èç¹û n »ò @nvar Ϊ¸º£¬Ôò·µ»Ø´ÓÓαêĩβ¿ªÊ¼ÏòÇ°µÄµÚ n ÐУ¬²¢½«·µ»ØÐбä³Éеĵ±Ç°ÐС£Èç¹û n »ò @nvar Ϊ 0£¬Ôò²»·µ»ØÐС£n ±ØÐëÊÇÕûÊý³£Á¿£¬²¢ÇÒ @nvar µÄÊý¾ÝÀàÐͱØÐëΪ smallint¡¢tinyint »ò int¡£
RELATIVE { n | @nvar}
Èç¹û n »ò @nvar ΪÕý£¬Ôò·µ»Ø´Óµ±Ç°ÐпªÊ¼ÏòºóµÄµÚ n ÐУ¬²¢½«·µ»ØÐбä³Éеĵ±Ç°ÐС£Èç¹û n »ò @nvar Ϊ¸º£¬Ôò·µ»Ø´Óµ±Ç°ÐпªÊ¼ÏòÇ°µÄµÚ n ÐУ¬²¢½«·µ»ØÐбä³Éеĵ±Ç°ÐС£Èç¹û n »ò @nvar Ϊ 0£¬Ôò·µ»Øµ±Ç°ÐС£ÔÚ¶ÔÓαê½øÐеÚÒ»´ÎÌáȡʱ£¬Èç¹ûÔÚ½« n »ò @nvar ÉèÖÃΪ¸ºÊý»ò 0 µÄÇé¿öÏÂÖ¸¶¨ FETCH RELATIVE£¬Ôò²»·µ»ØÐС£n ±ØÐëÊÇÕûÊý³£Á¿£¬@nvar µÄÊý¾ÝÀàÐͱØÐëΪ smallint¡¢tinyint »ò int¡£
GLOBAL
Ö¸¶¨ cursor_name ÊÇָȫ¾ÖÓαꡣ
cursor_name
Òª´ÓÖнøÐÐÌáÈ¡µÄ´ò¿ªµÄÓαêµÄÃû³Æ¡£Èç¹ûÈ«¾ÖÓαêºÍ¾Ö²¿Óα궼ʹÓà cursor_name ×÷ΪËüÃǵÄÃû³Æ£¬ÄÇôָ¶¨ GLOBAL ʱ£¬cursor_name Ö¸µÄÊÇÈ«¾ÖÓαꣻδָ¶¨ GLOBAL ʱ£¬cursor_name Ö¸µÄÊǾֲ¿Óαꡣ
@ cursor_variable_name
Óαê±äÁ¿Ãû£¬ÒýÓÃÒª´ÓÖнøÐÐÌáÈ¡²Ù×÷µÄ´ò¿ªµÄÓαꡣ
INTO @variable_name[ ,...n]
ÔÊÐí½«ÌáÈ¡²Ù×÷µÄÁÐÊý¾Ý·Åµ½¾Ö²¿±äÁ¿ÖС£ÁбíÖеĸ÷¸ö±äÁ¿´Ó×óµ½ÓÒÓëÓαê½á¹û¼¯ÖеÄÏàÓ¦ÁÐÏà¹ØÁª¡£¸÷±äÁ¿µÄÊý¾ÝÀàÐͱØÐëÓëÏàÓ¦µÄ½á¹û¼¯ÁеÄÊý¾ÝÀàÐÍÆ¥Å䣬»òÊǽá¹û¼¯ÁÐÊý¾ÝÀàÐÍËùÖ§³ÖµÄÒþʽת»»¡£±äÁ¿µÄÊýÄ¿±ØÐëÓëÓαêÑ¡ÔñÁбíÖеÄÁÐÊýÒ»Ö¡£
×¢ÊÍ
Èç¹û SCROLL Ñ¡ÏîδÔÚ ISO ÑùʽµÄ DECLARE CURSOR Óï¾äÖÐÖ¸¶¨£¬Ôò NEXT ÊÇΨһ֧³ÖµÄ FETCH Ñ¡Ïî¡£Èç¹ûÔÚ ISO ÑùʽµÄ DECLARE CURSOR Óï¾äÖÐÖ¸¶¨ÁË SCROLL Ñ¡ÏÔòÖ§³ÖËùÓÐ FETCH Ñ¡Ïî¡£
Èç¹ûʹÓà Transact-SQL DECLARE ÓαêÀ©Õ¹²å¼þ£¬ÔòÓ¦ÓÃÏÂÁйæÔ
Ïà¹ØÎĵµ£º
µÚÒ»ÖÖ JavaScriptÁ¬½ÓÊý¾Ý¿â£º
<mce:script language="JavaScript"><!--
// ´´½¨Êý¾Ý¿â¶ÔÏó
var objdbConn = new ActiveXObject("ADODB.Connection");
// DSN×Ö·û´®
var strdsn = "Driver={SQL Server};SERVER=192.168.0.210;UID=xhb;PWD=xhb;DATABASE=books";
// ´ò¿ªÊý¾ÝÔ´
objdbConn.Open(strdsn);
// ......
//×ܼǼÊý
function sumRecord()
{
var conn= Server.CreateObject("ADODB.connection");
var rs= Server.CreateObject("adodb.recordset");
conn.open("PROVIDER=SQLOLEDB;DATA SOURCE=127.0.0.1;UID=sa;PWD=123456;DATABASE=test");
var sql = "select count(*) as RecordCount from baoming";
rs.open(sql, ......
//×ܼǼÊý
function sumRecord()
{
var conn= Server.CreateObject("ADODB.connection");
var rs= Server.CreateObject("adodb.recordset");
conn.open("PROVIDER=SQLOLEDB;DATA SOURCE=127.0.0.1;UID=sa;PWD=123456;DATABASE=test");
var sql = "select count(*) as RecordCount from baoming";
rs.open(sql, ......
<Language from="SQL" To="C#">
<Type from="bigint" To="long" />
<Type from="binary" To="object" />
<Type from="bit" To="bool" />
<Type from="char" To="string" />
<Type from="datetime" To="DateTime" ......
sqlserver¸½¼ÓÊý¾Ý¿â´íÎó823µÄ½â¾ö·½°¸2008-10-13 15:06sqlserver¸½¼ÓÊý¾Ý¿â´íÎó823µÄ½â¾ö·½°¸Ò»¡¢SQL-Server¸½¼ÓÊý¾Ý¿âʱʧ°Ü¡£
1¡¢Òì³£Çé¿ö£º·þÎñÆ÷ÔÚÕý³£ÔËÐеÄÇé¿öÏÂͻȻ¶Ïµç£¬µ¼ÖÂÊý¾Ý¿âÎļþË𻵣¬¾ßÌå±íÏÖÊÇ£ºÊý¾Ý¿âÃûºóÃæÓГ£¨ÖÃÒÉ£©”×ÖÑù¡£
2¡¢Òì³£·ÖÎö£º¹ØÓÚ823´íÎóµÄ SQL-SERVER ÖеİïÖú£º
=== ......