SQL·ÖÒ³·½·¨
±íÖÐÖ÷¼ü±ØÐëΪ±êʶÁУ¬[ID] int IDENTITY (1,1)
Ò²¿ÉÒÔʹÓÃÁªºÏÖ÷¼ü id+id2+id3+……
1.·ÖÒ³·½°¸Ò»£º(ÀûÓÃNot InºÍSELECT TOP·ÖÒ³)
Óï¾äÐÎʽ£º
SELECT TOP 10 *
from TestTable
WHERE (ID NOT IN
(SELECT TOP 20 id
from TestTable
ORDER BY id))
ORDER BY ID
SELECT TOP Ò³´óС *
from TestTable
WHERE (ID NOT IN
(SELECT TOP Ò³´óС*Ò³Êý id
from ±í
ORDER BY id))
ORDER BY ID
2.·ÖÒ³·½°¸¶þ£º(ÀûÓÃID´óÓÚ¶àÉÙºÍSELECT TOP·ÖÒ³£©
Óï¾äÐÎʽ£º
SELECT TOP 10 *
from TestTable
WHERE (ID >
(SELECT MAX(id)
from (SELECT TOP 20 id
from TestTable
ORDER BY id) AS T))
ORDER BY ID
SELECT TOP Ò³´óС *
from TestTable
WHERE (ID >
(SELECT MAX(id)
from (SELECT TOP Ò³´óС*Ò³Êý id
from ±í
ORDER BY id) AS T))
ORDER BY ID
3.·ÖÒ³·½°¸Èý£º(ÀûÓÃSQLµÄÓαê´æ´¢¹ý³Ì·ÖÒ³)
create procedure SqlPager
@sqlstr nvarchar(4000), --²éѯ×Ö·û´®
@currentpage int, --µÚNÒ³
@pagesize int --ÿҳÐÐÊý
as
set nocount on
declare @P1 int, --P1ÊÇÓαêµÄid
@rowcount int
exec sp_cursoropen @P1 output,@sqlstr,@scrollopt=1,@ccopt=1, @rowcount=@rowcount output
select ceiling(1.0*@rowcou
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
SQL Server .NET Data Provider Á¬½Ó×Ö·û´®°üº¬Ò»¸öÓÉһЩÊôÐÔÃû/Öµ¶Ô×é³ÉµÄ¼¯ºÏ¡£Ã¿Ò»¸öÊôÐÔ/Öµ¶Ô¶¼ÓɷֺŸô¿ª¡£
PropertyName1=Value1;PropertyName2=Value2;PropertyName3=Value3;.....
ͬÑù£¬Á¬½Ó×Ö·û´®±ØÐë°üº¬SQL ServerʵÀýÃû³Æ:
  ......
1)
¼Ù¶¨ÓÐÒ»¸öÓû§±í£¬±íÖаüº¬×ֶΣº
userid
(int)
¡¢
username
(varchar)
¡¢
password(varchar)
¡¢µÈ£¬
¸Ã±íÐèÒªÉèÖÃÖ÷¼ü£¬ÒÔÏÂ˵·¨ÕýÈ·µÄÊÇ£¨£©¡££¨Ñ¡ÔñÁ½Ï
a)
Èç¹û²»ÄÜÓÐͬʱÖظ´µÄ
username
ºÍ
password
£¬ÄÇô
username
ºÍ
password
¿ÉÒÔ×éºÏÔÚÒ»Æð×÷ΪÖ÷¼ü¡£
  ......
--exec [P_AutoGenerateNumber] 'reception_apply','generate_code','',7
/*
¹ý³Ì˵Ã÷:Éú³É×Ô¶¯±àºÅ
´´½¨Ê±¼ä:2010Äê1ÔÂ12ÈÕ
×÷Õß:feng
debug:ÉÐδ¿¼ÂDZàºÅÒç³öÇé¿ö
*/
ALTER proc [P_AutoGenerateNumber]
(
@table ......
ÉÁ»Ø
1 ÌØÕ÷
ÉÁ»ØÊý¾Ý¿âÖ»ÊÇÂß¼Êý¾ÝÔâµ½ÆÆ»µÊ±µÄÊֶΡ£
ÉÁ»ØÊý¾Ý¿âÈÕÖ¾±ØÐëÔÚÊý¾Ý¿â»Ö¸´ÇøÖд´½¨¡£
ÉÁ»ØÈÕÖ¾²»ÐèÒª¹éµµ£¬²»ÄÜÓÃÓÚÎïÀí»Ö¸´¡£
Ö´ÐÐÉÁ»ØÊý¾Ý¿â²Ù×÷ʱ£¬±³¾°½ø³ÌRVWR¾ÍÆô¶¯ÁË¡£
2 ʹÓÃÉÁ»ØÊý¾Ý¿â
3ÖÖ¹¤¾ß£¬SQL*Plus£¬RMAN£¬OEM¡£
£¨1£©ÒªÇó
ΪÁËʹÓÃÉÁ»ØÊý¾Ý¿â£¬Êý¾Ý¿â±ØÐë´¦Óڹ鵵ÈÕ־ģʽ¡ ......