ÔÚCMDϲÙ×÷SQL SERVERÊý¾Ý¿â
MYSQL¿ÉÒÔÔÚ¿ØÖÆ̨ϽøÐвÙ×÷£¬ÀûÓÃÃüÁî
SQL´úÂë
mysql -h localhost -u root -p123456
¾Í¿ÉÒԵǽMYSQLµÄ¿ØÖÆ̨¡£
sql serverÒ²ÌṩÁË¿ØÖÆ̨ϵIJÙ×÷¹¦ÄÜ¡£
ÔÚSQL SERVERµÄ binnĿ¼Ï£¬ÌṩÁËosql.exeÓëisql.exeÕâÁ½¸öÎļþ¡£
ÕâÁ½¸ö³ÌÐò¶¼ÌṩÁË·ÃÎÊSQL SERVERµÄ¹¦ÄÜ£¬ÕâÁ½¸ö³ÌÐòÔÚÁ¬½ÓSQL SERVERµÄ·½Ê½ÉÏÓÐÇø±ð¡£
osql.exeͨ¹ýODBCµÄ·½Ê½ÓëSQL SERVER½øÐÐÁ¬½Ó £¬¶øisql.exeͨ¹ýdb libraryµÄ·½Ê½À´Á¬½ÓSQL SERVER¡£
CSDNÉϵÄÊý¾Ý¿âÅ£ÃÇÍƼöʹÓÃOSQL½øÐвÙ×÷£¬¾ßÌåÔÒòÒ²²»¹ÜÄÇô¶àÁË£¬ÔÛÃÇ»áµã¼òµ¥µÄ²Ù×÷¾ÍÐÐÁË¡£¡£
ÔÚCMDÏÂÊäÈëosql -? ¾Í¿ÉÒÔ¿´µ½°ïæÐÅÏ¢ÁË¡£
C:\>osql -?
Microsoft (R) SQL Server ÃüÁîÐй¤¾ß
°æ±¾ 9.00.1399.06 NT INTEL X86
°æȨËùÓÐ (c) Microsoft Corporation¡£±£ÁôËùÓÐȨÀû¡£
×¢Òâ: osql ²¢²»Ö§³Ö SQL Server 2005µÄËùÓй¦ÄÜ¡£
ÇëʹÓà sqlcmd¡£ÓйØÏêϸÐÅÏ¢£¬Çë²ÎÔÄ SQL Server Áª»ú´ÔÊé¡£
Ó÷¨: osql [-U µÇ¼ ID] [-P ÃÜÂë]
[-S ·þÎñÆ÷] [-H Ö÷»úÃû] [-E ¿ÉÐÅÁ¬½Ó]
[-d ʹÓÃÊý¾Ý¿âÃû³Æ] [-l µÇ¼³¬Ê±Öµ] [-t ²éѯ³¬Ê±Öµ]
[-h ±êÌâ] [-s Áзָô·û] [-w Áпí]
[-a Êý¾Ý°ü´óС] [-e »ØÏÔÊäÈë] [-I ÔÊÐí´øÒýºÅµÄ±êʶ·û]
[-L Áгö·þÎñÆ÷] [-c ÃüÁî½áÊø] [-D ODBC DSN Ãû³Æ]
[-q "ÃüÁîÐвéѯ"] [-Q "ÃüÁîÐвéѯ" ²¢Í˳ö]
Ïà¹ØÎĵµ£º
дһ¸ö´æ´¢¹ý³Ì£¬½«±íÒ»°´ÕÕ±í¶þµÄÐÎʽ½øÐвéѯ¡£
²Ö¿âÃû³Æ ÉÌÆ·Ãû³Æ ÊýÁ¿
A
S001 12
A S002 17
A
S003 10
B S001 21
B
S002 5
B S003 ......
-
´¦Àí±íÖظ´¼Ç¼(²éѯºÍɾ³ý)
/*
*****************************************************************************************************************************************************
1¡¢Num¡¢NameÏàͬµÄÖظ´Öµ¼Ç¼,ûÓдóС¹Øϵֻ±£ÁôÒ»Ìõ
2¡¢NameÏàͬ,IDÓдóС¹Øϵʱ,±£Áô´ó»òСÆäÖÐÒ»¸ö¼Ç¼
ÕûÀíÈË£ºÖÐ ......
SqlserverÕⶫÎ÷ûÉÙ¸úËû´ò½»µÀ,¸Õѧ¿ª·¢ÓïÑÔʱ¾ÍÒѾ¸úËû½Ó´¥ÁË,²»ÒªËµºÜ¾«Í¨,µ«¾ÍÓï·¨»¹ËãÊÇÊìϤ,µ«ÏÖÔÚ¿ªÊ¼Ð´C#,·¢ÏÖºÜC#¶àÁËÒ»ÖÖSqlServerµÄ²ÎÊý´«È뷽ʽ,ÒÔÍùÎÒÃdz£³£¶ÔÒª´«²ÎµÄSqlÓï¾ä¶¼ÊÇÖ±½Óͨ¹ýÆ´´ÕSqlÓï¾äµÄ·½Ê½À´ÊµÏÖ,µ«ÏÖÔÚC#ΪʲôҪרÃÅ×öÒ»¸öSql²ÎÊýµÄÀàÀ´ÊµÏÖÄØ,¾¹ý²éÕÒ²ÅÖªµÀ,ÕâÑù×öÊÇÓеÀÀíµÄ,Ò»Ê ......
½ñÌìÎÒÔÚSQL Server 2005ÖÐÓýű¾´´½¨Ò»ÕÅ±í£¬²é×ÊÁÏ·¢ÏÖÓеĽű¾ÖÐ×Ö¶ÎÓмÓ[]ÖзûºÅ£¬ÎÒÎÊÁ˶¬¼¾£¬µÃÖªÊÇÕâ»ØÊ£¬ÓÃ[]µÄ×Ö¶ÎÃû£¬¼´±ãÊÇsql¹Ø¼ü×ÖÒ²¿ÉÒÔ×÷Ϊ×Ö¶ÎÃû£¬²»»á±¨´í¡£
SQL ServerÀïµÄ±íÖÐÌí¼ÓÒ»¸ö×ֶΣ¬È磺timeϵͳ»á×Ô¶¯¼ÓÒ»¶Ô·½À¨ºÅ¼´£º[time] ......
ºÜ¶àʱºòÎÒÃÇ¿ÉÄܶ¼ÐèÒªÕâôһ¸ö¼ò·±»¥Ïàת»»µÄSQLº¯Êý£¬½ñÌìÔÚÍøÉÏÕÒµ½µÄ£¬ÊÕ¼¯ÏÂÀ´¡£
ÒÔºóÓÐÁËËü¾ÍʡʶàÀ²¡£²»ÓÃÔÙд³ÌÐòÈ¡³öÀ´×ª»»ºóÔÙ¸üÐÂÊý¾Ý¿âÁË¡£
SQL¼òÌå·±Ìåת»»º¯Êý´úÂ룺
--Éú³ÉÂë±í
if exists (select * from dbo.sysobjects where id = object_id(N'[codetable]') and OBJECTPROPERTY(id, N'IsUserTable' ......