Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : sqlserver

¹ØÓÚSQLSERVER ²éѯµÄÎÊÌâ

´ó¼ÒºÃ ×î½üÓöµ½µãÂé·³ Çë´ó¼Ò°ïæ ÈçÏ £º

ÎÒÔÚÒ»¸öѧÉúµÄÊý¾Ý¿â STU ÖвéѯSTUDENTS ±íÖÐ Ïà¹ØµÄÊý¾Ý

CREATE TABLE STUDENTS
(
ID INT IDENTITY(1,1) PRIMARY KEY ,
[NAME] VARCHAR(20) NOT NULL,
[CLASS] VARCHAR(10) NOT NULL,
SEX INT NOT NULL, -- 0»ò1
)

±ÈÈç ¸ù¾Ý °à¼¶ ÐÔ ......

¼±¼±¼±,SqlServerµÄÎÊÌâ

ÎÒÍùSqlServerÖмÓÊý¾ÝµÄʱºò,Ëû¸øÎÒ±¨Á˸ö´í
˵:"µ± IDENTITY_INSERT ÉèÖÃΪ OFF ʱ£¬²»ÄÜÏò±í 'O_TRAIN_CATEGORY' ÖеıêʶÁвåÈëÏÔʽֵ¡£"
ÒòΪÎÒÕâ¸ö±íµÄÖ÷¼üÉèÖõÄÊÇ×ÔÔöµÄ!ÊDz»ÊÇ×ÔÔöû¿ª°¡?Ôõô¸Ä°¡?
SQL code:

set IDENTITY_INSERT [±íÃû] on --´ò¿ª
set IDENTITY_INSERT [±íÃû] off --¹Ø±Õ

Õ ......

shell½Å±¾¶ÁÈ¡rrdÎļþ½«Êý¾Ý²åÈësqlserverÊý¾Ý¿âÖÐ

ÓÃshell½Å±¾Ð´¸öС³ÌÐò£¬²»Í£µÄ¶ÁÈ¡rrdÎļþ£¬½«Êý¾Ý²åÈësqlserverÊý¾Ý¿âÖУ¬Çë¸ßÊÖ ½â´ð£¬ÔÚÏߵȣ¡£¡£¡

²»ÑÏÖØ£¬¿ÉÒÔ·ÃÎʱðµÄ·þÎñÆ÷µÄÊý¾Ý¿âÂð£¿

¸øÄãÒ»¸ö˼·£º
shell½Å±¾¶ÁÈ¡Îļþ£º¼ÙÉèÊý¾ÝÎļþÖÐÒ»ÐÐÊÇÒ»Ìõ¼Ç¼£¬¸ù¾Ý·Ö¸ô·ûºÍÊý¾Ý¿â±í½á¹¹£¨²é¿´Êý¾Ý¿â±í½á¹¹Ò²ÐèÒªµÇ¼Êý¾Ý¿â²éѯ£©À´Éú³ÉÏàÓ¦µÄinsertÓï¾ä£¬
......

SQLserverÊý¾Ý²éѯ£¬¸ßÊÖ½øÀ´¿´ÏÂ

±àºÅ ¼¶±ð Ãû³Æ Éî¶È
1 0 ÐÂÎÅ 1
2 0 ²Æ¾­ 1
3 1 ¾üÊ 2
4 2 ¹ÉƱ 3
5 0 ·¿²ú 1
6 1 Çé¸Ð 2
7 1 ¹úÄÚ 2
8 1 ¹ú¼Ê 2
14 2 ÓÊÕþµçÐÅ 2
15 2 »·±£ 2
16 5 ITÆóÒµ 2
17 5 Éú»îÓÃÆ· 2
18 5 ÓÎÏ·ÓëÍøÂç 2
19 2 ÄÜÔ´¹¤Òµ 2
20 2 »¯Ñ§¹¤Òµ 2
Ôõô°Ñ¸¸¼¶Ï ......

SQLserverÉú³Éinsert into´øÊý¾Ý½Å±¾.

ÓÐʲô¹¤¾ß¿ÉÒÔ°ÑsqlserverµÄÊý¾ÝÉú³Éinsert intoµÄ½Å±¾?ÏñmysqlÄÇÑùµ¼³ö.sqlÎļþ.
mssqlÖ»¿ÉÒÔÉú³É±í½á¹¹µÄsqlÎļþ.²»´øÊý¾ÝµÄ.
Èç¹û±íÉٵĻ°
×Ô¼ºÆ´°É

Â¥Ö÷˵µÄÊÇÒª°ÑÊý¾Ý¿âÄÚµÄÒѲåÈëµÄÊý¾ÝתΪSQL½Å±¾?

SQL×Ô´øµÄ¹¤¾ß¿ÉÒÔÉú³É±í½á¹¹ÐÅÏ¢½Å±¾.

SQL code:
*********************************************** ......

Çë½ÌSQLSERVERµÄÁ½¸öÎÊÌâ - MS-SQL Server / ÒÉÄÑÎÊÌâ

1¡£ÔõÑùʹxp_cmdshellÄÜÍêÕûÊä³ö³¬¹ý255¸ö×Ö·ûµÄ×Ö·û´®¡£
2¡£select ʱ£¬¼ìË÷ËÙ¶ÈÊÇÓëfromºóµÄ TABLE˳ÐòÓйأ¬»¹ÊÇÓëwhereÌõ¼þµÄ˳ÐòÓйØ(TABLEÊý¾Ý¶àÉÙ )
ÔÚϵͳÊôÐÔÉ趨ÀïÓиöÑ¡Ïî,¿ÉÒÔÐ޸ĵ¥×Ö¶ÎÊä³ö×ÖÊýÏÞÖÆ.ĿǰĬÈÏÊÇ255¸ö×Ö·û. ¿ÉÒÔÐ޸ĵ½×î¶à8000»ò4000×Ö·û.


Êä³öµ½ÎļþÖÐÈ¥
EXEC master..xp_cmdshell 'ec ......
×ܼǼÊý:322; ×ÜÒ³Êý:54; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [3] [4] [5] [6] 7 [8] [9] [10] [11] [12]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ