SQLServerÖÐÎÄ´¦Àí
Ê×ÏȲå¾äÌâÍâ»°£º´´½¨Ò»¸ö×ÔÈ»Êý±íNums¡£ÕâÊÇ¡¶SQL Server 2005¼¼ÊõÄÚÄ»£ºT-SQL²éѯ¡·Ò»ÊéµÄ½¨Òé¡£
ÔÚSQL Server 2005ÖУ¬¿ÉÒÔ½èÓÃROW_NUMBERÅÅÃûº¯ÊýÇáËÉÉú³ÉÎÒÃÇËùÐèµÄ×ÔÈ»Êý±í£º
--×ÔÈ»Êý±í1-1M
CREATE TABLE Nums(n int NOT NULL PRIMARY KEY CLUSTERED)
WITH B1 AS(SELECT n=1 UNION ALL SELECT n=1), --2
B2 AS(SELECT n=1 from B1 a CROSS JOIN B1 b), --4
B3 AS(SELECT n=1 from B2 a CROSS JOIN B2 b), --16
B4 AS(SELECT n=1 from B3 a CROSS JOIN B3 b), --256
B5 AS(SELECT n=1 from B4 a CROSS JOIN B4 b), --65536
CTE AS(SELECT r=ROW_NUMBER() OVER(ORDER BY (SELECT 1)) from B5 a CROSS JOIN B3 b) --65536 * 16
INSERT INTO Nums(n)
SELECT TOP(1000000) r from CTE ORDER BY r
ÒÔÉÏÓï¾äÉú³ÉÇ°100Íò¸ö×ÔÈ»Êý¡£
ÒÔÏ¿ªÊ¼ÕýÌâ¡£
Ò»¡¢×Ö·û±àÂëÓëÅÅÐò¹æÔò
×ö¹ýWeb¿ª·¢µÄÈ˶Ô×Ö·û±àÂëÒ»¶¨²»Ä°Éú¡£¼òµ¥À´Ëµ£¬ÈËËùÄܹ»Ê¶±ðµÄ×Ö·ûÈç“A”¡¢“Ò»”Óë¼ÆËã»úÄÚ²¿²Ù×÷µÄÊý×Ö01000001¡¢1101001010111011ÊDz»Ò»ÑùµÄ£¬ÐèÒª½¨Á¢Ò»ÖÖ¶ÔÓ¦¹ØϵÀ´ÈüÆËã»úÄܹ»“ʶ±ð”ÈËÃÇËùʹÓõÄ×Ö·û£¨»òÕß˵ÊÇÈÃÈËÃÇÄܹ»ÓÃ×Ô¼ºÏ°¹ßµÄ·½Ê½Ê¶±ð¼ÆËã»ú²Ù×÷µÄÊý×Ö£©£¬×Ö·û±àÂë¾ÍÊÇÕâ¸ö¶ÔÓ¦¹Øϵ¡£
¶ÔÓÚÓ¢ÓïÀ´Ëµ£¬´óСд×Öĸ¼ÓÊý×Ö¼Ó±êµã·ûºÅ£¬×ܹ²Ò²²»»á³¬¹ý128¸ö£¬Ò»¸ö×ֽھ͹»ÓÃÁË£»ASCII±àÂëֻʹÓÃÁËÒ»¸ö×Ö½ÚÖеÄ7룬±ãÒѾ°üÀ¨ÁËÓ¢Óï³£ÓÃ×Ö·û£¬»¹¼ÓÉÏÁËÒ»×éµç´«´ò×Ö»úʱ´úµÄ¿ØÖÆ×Ö·û£¨ÖÁ½ñÈÔÔÚʹÓÃÆäÖм¸¸ö£©¡£
È»¶øÊÀÉϲ¢²»½öÓÐÓ¢ÓŷÖÞһЩÓïÑÔÐèҪʹÓõÄһЩÖØÒô×Ö·û²¢Ã»ÓаüÀ¨ÔÚASCII±àÂëÖУ»¶øÑÇÖÞµÄCJK£¨Ö¸China+Japan+Korea£©ÓïÑÔ×Ö·û¶à´ï¼¸Íò¸ö£¬¸üÊÇÔ¶Ô¶³¬¹ýÁËÒ»¸ö×Ö½ÚËùÄܱíʾµÄ·¶Î§£»ÔÙ¼ÓÉÏ°¢À²®Óϣ²®À´ÓïµÈµÈ……
½â¾ö°ì·¨×ÔÈ»ÊÇÀ©³ä×Ö·û±àÂëλÊý¡£Ë«×Ö½Ú¿ÉÒÔ±íʾ65536¸ö×Ö·û£¬Í¨³£Çé¿öÏÂÊÇ×ã¹»ÁË¡£µ«ÕâʱÓÖÓÐÒ»¸öеÄÎÊÌ⣺µ±¼ÆËã»ú¶Áµ½Á½¸öÁ¬ÐøµÄ×Ö½Ú£¬ËüÓ¦¸Ã½«Ö®Àí½âΪÁ½¸öµ¥¶ÀµÄ×Ö·û»¹ÊÇÒ»¸ö×Ö·û£¿±àÂë·½°¸ÐèÒª½â¾öÕâ¸öÎÊÌâ¡£
µÚÒ»ÖÖ·½°¸ÊÇ΢ÈíÒýÈëµÄ´úÂëÒ³µÄ¸ÅÄî¡£ASCIIֻʹÓÃÁËÒ»¸ö×Ö½ÚµÄ7룬×Ö½Ú×î¸ßλÊÇ0£¬ÄÇô¿ÉÒÔÓÃ×î¸ßλÊÇ1µÄ·¶Î§À´±íʾÀ©Õ¹×Ö·û¡£¶ÔÓÚ¶àÊýÅ·ÖÞÓïÑÔ£¬Ò»¸ö×Ö½ÚµÄ256¸ö×Ö·ûÒÑÈ»×ã¹»£¬ÄÇô±ãÓÃ×Ö½Ú×î¸ßλÊÇ1µÄ128¸ö×Ö·ûÀ´±íʾÈçÖØÒô×Ö·û¡¢ÖƱí·ûµÈÀ©Õ¹×Ö·û£»¶ÔÓÚÑÇÖÞÓïÑÔ£¬Ê¹ÓÃÁ½¸öÁ¬ÐøµÄ×î¸ßλÊÇ1µÄ×Ö½ÚÀ´±íʾCJK×Ö·û£¬ÕâÑù£¬µ±¼ÆËã»ú¶Áµ½Ò»¸ö×î¸ßλÊÇ0µ
Ïà¹ØÎĵµ£º
´úÂëÈçÏÂ:
DECLARE
@TempTable table(UserID int , UserName nvarchar(50));
insert into
@TempTable (UserID,UserName) values (1,'a')
insert into @TempTable
(UserID,UserName) values (2,'b')
select UserID,UserName
from @TempTable FOR XML PATH
ÔËÐÐÕâ¶Î½Å±¾£¬½«Éú³ÉÈçϽá¹û£º
¸´ÖÆ´úÂë
......
bcpÃüÁîÊÇSQL ServerÌṩµÄÒ»¸ö¿ì½ÝµÄÊý¾Ýµ¼Èëµ¼³ö¹¤¾ß¡£Ê¹ÓÃËü²»ÐèÒªÆô¶¯ÈκÎͼÐιÜÀí¹¤¾ß¾ÍÄÜÒÔ¸ßЧµÄ·½Ê½µ¼Èëµ¼³öÊý¾Ý¡£bcpÊÇSQL ServerÖиºÔðµ¼Èëµ¼³öÊý¾ÝµÄÒ»¸öÃüÁîÐй¤¾ß£¬ËüÊÇ»ùÓÚDB-LibraryµÄ£¬²¢ÇÒÄÜÒÔ²¢Ðеķ½Ê½¸ßЧµØµ¼Èëµ¼³ö´óÅúÁ¿µÄÊý¾Ý¡£bcp¿ÉÒÔ½«Êý¾Ý¿âµÄ±í»òÊÓͼֱ½Óµ¼³ö£¬Ò²ÄÜͨ¹ýSELECT fromÓï¾ä¶Ô±í»òÊÓ ......
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Îļþ£¬ÒÔÇ°µÄÎÄÕÂÖÐÒѾ½²¹ ......
Óû§È¨ÏÞ¹ÜÀí
Ò»¡¢·þÎñÆ÷µÇ¼ÕʺźÍÓû§ÕʺŹÜÀí
1.SQL Server·þÎñÆ÷µÇ¼¹ÜÀí
²»¹ÜʹÓÃÄÄÖÖÈÏ֤ģʽ£¬Óû§¶¼±ØÐëÏȾ߱¸ÓÐЧµÄÓû§µÇ¼Õʺš£SQL ServerÓÐÈý¸öĬÈϵÄÓû§µÇ¼Õʺţº¼´sa¡¢Builtin\administratorsºÍguest¡£saÊÇϵͳ¹ÜÀíÔ±(system administrator)µÄ¼ò³Æ£¬ÊÇÒ»¸öÌØÊâµÄÓû§£¬ÔÚSQL ServerϵͳºÍËùÓÐÊý¾Ý¿âÖÐÓ ......
ÔÚƽʱµÄ¹¤×÷¹ý³ÌÖУ¬×÷ΪDBA½ÇÉ«¹ÜÀíÊý¾Ý¿â£¬Í·ÄÔÖеÄÓ¡ÏóÍùÍùÊÇÊý¾Ý¿âʵÀýÃû³Æ£¬¶ø²»»áÈ¥¹ØÐÄServerµÄIP£¬¶ø×÷ΪDeveloperµÄ½ÇÉ«£¬ËûÃÇÍùÍùÏëÖªµÀÖªµÀServer IpºÍ¶Ë¿ÚºÅ¡£ËùÒÔ£¬DBA»á¾³£±»Îʼ°µ½£ºXXXʵÀýµÄIPºÍ¶Ë¿ÚºÅÊÇʲô£¿
Õâ¸öÎÊÌ⣬µ±È»ÎÒÃÇ¿ÉÒÔLoginµ½OS²é¿´IP¡¢Ê¹ÓÃÅäÖƹÜÀí¹¤¾ß»ñÈ¡µ½¶Ë¿ÚºÅ¡£µ«ÊÇ£¬Õâ¸ö·½·¨·Ç ......