SQLSERVERÓû§È¨ÏÞ¹ÜÀíÊý¾Ý¿â
Óû§È¨ÏÞ¹ÜÀí
Ò»¡¢·þÎñÆ÷µÇ¼ÕʺźÍÓû§ÕʺŹÜÀí
1.SQL Server·þÎñÆ÷µÇ¼¹ÜÀí
²»¹ÜʹÓÃÄÄÖÖÈÏ֤ģʽ£¬Óû§¶¼±ØÐëÏȾ߱¸ÓÐЧµÄÓû§µÇ¼Õʺš£SQL ServerÓÐÈý¸öĬÈϵÄÓû§µÇ¼Õʺţº¼´sa¡¢Builtin\administratorsºÍguest¡£saÊÇϵͳ¹ÜÀíÔ±(system administrator)µÄ¼ò³Æ£¬ÊÇÒ»¸öÌØÊâµÄÓû§£¬ÔÚSQL ServerϵͳºÍËùÓÐÊý¾Ý¿âÖÐÓµÓÐËùÓеÄȨÏÞ¡£SQL Server»¹ÎªÃ¿Ò»¸öWindows NTϵͳ¹ÜÀíÔ±ÌṩÁËÒ»¸öĬÈϵÄÓû§ÕʺÅBuiltin\administrators¡£Õâ¸öÕʺÅÔÚϵͳºÍËùÓÐÊý¾Ý¿âÖÐÒ²ÓµÓÐËùÓеÄȨÏÞ¡£¶øguestÕʺÅΪĬÈÏ·ÃÎÊϵͳÓû§Õʺš£ÀûÓÃÆóÒµ¹ÜÀíÆ÷¿ÉÒÔ´´½¨¡¢¹ÜÀíSQL ServerµÇ¼Õʺš£Æä¾ßÌå²½ÖèÈçÏ£º
(1)´ò¿ªÆóÒµÆ÷£¬µ¥»÷·þÎñÆ÷µÄ“+”£¬Õ¹¿ª°²È«ÐÔÎļþ¼Ð£»
(2)ÓÒ»÷µÇ¼ͼ±ê£¬Ñ¡Ôñ“н¨µÇ¼”£»
(3)ÔÚ“Ãû³Æ”Îı¾¿òÖÐÊäÈëµÇ¼Ãû£¬Ñ¡Ôñн¨µÄÓû§ÕʺŵÄÈÏ֤ģʽ£»²¢Ñ¡ÔñĬÈϵÄÊý¾Ý¿âºÍÓïÑÔ¡£
(4)Ñ¡Ôñ“·þÎñÆ÷½ÇÉ«”£¬ÔÚÁгöµÄ¹Ì¶¨·þÎñÆ÷½ÇÉ«µÄ×ó¶Ë¸´Ñ¡¿òÖÐÑ¡ÔñÏàÓ¦µÄ·þÎñÆ÷½ÇÉ«£»
(5)Ñ¡Ôñ“Êý¾Ý¿â·ÃÎÊ”£¬µ¥»÷Êý¾Ý¿â×ó±ßµÄ¸´Ñ¡¿ò£¬±íʾ¸ÃÓû§¿ÉÒÔ·ÃÎÊÏàÓ¦µÄÊý¾Ý¿âÒÔ¼°¸ÃÕʺÅÔÚÊý¾Ý¿âÖеÄÓû§Ãû¡£Ï²¿µÄÁбí¿òÁгöÁËÏàÓ¦µÄÊý¾Ý¿âÖеÄÊý¾Ý¿â½ÇÉ«Çåµ¥£¬¿ÉÒÔÖ¸¶¨¸ÃÕʺÅËùÊôµÄÊý¾Ý¿â½ÇÉ«£»
(6)µ¥»÷“È·¶¨”¼´¿ÉÍê³ÉµÇ¼ÕʺŵĴ´½¨¡£
´ËÍ⣬»¹¿ÉÒÔʹÓô´½¨µÇ¼Ïòµ¼¹¤¾ß´´½¨µÇ¼Õʺš£¾ßÌå¹ý³ÌÈçÏ£º
(1)´ò¿ªÆóÒµ¹ÜÀíÆ÷£¬Ñ¡Ôñ¹¤¾ßÖеēÏòµ¼--´´½¨µÇ¼Ïòµ¼”£»
(2)Ñ¡ÔñÉí·ÝÑé֤ģʽ£»
(3)
(4)
(5)
(6)
2.Óû§ÕʺŹÜÀí
ÔÚÊý¾Ý¿âÖУ¬Ò»¸öÓû§»ò¹¤×÷×éÈ¡µÃºÏ·¨µÄµÇ¼Õʺţ¬Ö»±íÃ÷¸ÃÕʺÅͨ¹ýÁËWindows NTÈÏÖ¤»òÕßSQL ServerÈÏÖ¤£¬µ«²»ÄܱíÃ÷Æä¿ÉÒÔ¶ÔÊý¾Ý¿âÊý¾ÝºÍÊý¾Ý¿â¶ÔÏó½øÐÐijÖÖ»òÕßijЩ²Ù×÷,scsi£¬Ö»Óе±ËûͬʱӵÓÐÁËÓû§Õʺź󣬲ÅÄܹ»·ÃÎÊÊý¾Ý¿â¡£ÔÚÒ»¸öÊý¾Ý¿âÖУ¬Óû§ÕʺÅΨһ±êʶһ¸öÓû§£¬Óû§¶ÔÊý¾Ý¿âµÄ·ÃÎÊȨÏÞÒÔ¼°¶ÔÊý¾Ý¿â¶ÔÏóµÄËùÓйØϵ¶¼ÊÇͨ¹ýÕʺÅÀ´¿ØÖƵġ£Óû§ÕʺÅ×ÜÊÇ»ùÓÚÊý¾Ý¿âµÄ£¬¼´Á½¸ö²»Í¬µÄÊý¾Ý¿â¿ÉÒÔÓÐÁ½¸öÏàͬµÄÓû§Õʺţ¬²¢ÇÒÒ»¸öµÇ¼ÕʺÅÒ²×ÜÊÇÓëÒ»¸ö»ò¶à¸öÊý¾Ý¿âÓû§ÕʺÅÏà¶ÔÓ¦µÄ¡£È磬µÇ¼ÕʺÅsa×Ô¶¯Óëÿһ¸öÊý¾Ý¿âÓû§dboÏà¹ØÁª¡£Í¨³£¶øÑÔ£¬Êý¾Ý¿âÓû§ÕʺÅ×ÜÊÇÓëijһµÇ¼ÕʺÅÏà¹ØÁª£¬µ«ÓÐÒ»¸öÀýÍ⣬ÄǾÍÊÇguestÓû§¡£ÔÚ°²×°SQL Serverϵͳʱ£¬guestÓû§±»¼ÓÈëµ½master£¬pubs£¬tempdbºÍnorthwindÊý¾Ý¿âÖУ¬¸ÃÓû§Ö÷ÒªÊÇÈÃÄÇЩûÓÐÊôÓÚ×Ô¼ºµÄÓû§ÕʺÅ
Ïà¹ØÎĵµ£º
Ñ¡ÔñÖ¸¶¨ÌõÊýÓï¾ä£º
db2£ºselect * from tabname fetch frist n rows only
informix£ºselect first n *
from tabname
oralce£ºselect * from tabname where rownum <= n
sql server :select top n * from tabname ......
http://www.tongyi.net/article/20031101/200311013786.shtml
ËùνµÄÊý¾Ý´«Ê䣬ÆäʵÊÇÖ¸SQLServer·ÃÎÊAccess¡¢Excel¼äµÄÊý¾Ý¡£
ΪʲôҪ¿¼Âǵ½Õâ¸öÎÊÌâÄØ£¿
ÓÉÓÚÀúÊ·µÄÔÒò£¬¿Í»§ÒÔÇ°µÄÊý¾ÝºÜ¶à¶¼ÊÇÔÚ´æÈëÔÚÎı¾Êý¾Ý¿âÖУ¬ÈçAcess¡¢Excel¡¢Foxpro¡£ÏÖÔÚϵͳÉý¼¶¼°Êý¾Ý¿â·þÎñÆ÷ÈçSQLServer¡¢ORACLEºó£¬¾³£ÐèÒª·ÃÎÊÎı¾Êý ......
1.½¨±í(Create table)ʱʹÓà IDENTITY (SEED,INCREMENT)
ÆäÖÐSEEDÊÇÆðʼֵ£¬INCREMENTÊÇÔöÁ¿¡£
Àý£º
CREATE TABLE mytable1
(
[user_id] BIGINT NOT NULL
IDENTITY(1, 1) ,
......
·ÖÒ³´æ´¢¹ý³Ì
sp_QueryPaging
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author:
-- Create date:
-- Description: ·ÖÒ³²éѯ
-- ·µ»ØµÄÊý¾ÝÖÐ×ÜÊÇÔÚÿÌõ¼Ç¼ǰ¼ÓÉÏÐкÅRowNumberÁС£
-- Èç¹ûδָ¶¨@StrSelect²ÎÊý£¬Ï൱ÓÚÉèÖÃËüΪ'*'
-- Èç¹ûδ ......
1.°²×°ºÃSQLServer 2005Êý¾Ý¿âÈí¼þ£¬½Ó×Å×îÖØÒªµÄ¾ÍÊÇ°²×°Êý¾Ý¿âÇý¶¯SQL Server 2005 driver for JDBC£¬¿ÉÒÔµ½:http://download.microsoft.com/download/8/B/D/8BDABAE2-B6EA-41D4-B903-7916EF3690EF/sqljdbc_1.2.2323.101_enu.exeÏÂÔØ
2.½«JDBC½âѹµ½ÈÎÒâµÄλÖã¬ÔÚ°²×°Ä¿Â¼ÀïÕÒµ½sqljdbc.jarÎļþ£¬ÒÔÇ°µÄÎÄÕÂÖÐÒѾ½²¹ý» ......