Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SqlServerÊý¾Ý¿â×ֵ䣨תÔØ£©


ÒýÓÃ×Ôhttp://blog.163.com/xing_aixin/blog/static/3723550520088189201623/
ÍøÉÏÓкܶàSQL ServerÊý¾Ý¿â×ÖµäµÄSQLÓï¾ä£¬ÆßÁã°ËÂ䣬ÎÒÔÚ¹¤×÷ÕûÀíÁËÒ»ÏÂ˼·£¬×ܽáSQL´úÂëÈçÏ¡£Êý¾Ý¿â×Öµä°üÀ¨±í½á¹¹(·Ö2KºÍ2005)¡¢Ë÷ÒýºÍÖ÷¼ü. Íâ¼ü.Ô¼Êø.ÊÓͼ.º¯Êý.´æ´¢¹ý³Ì.´¥·¢Æ÷¡£¿ÉÒÔÔÚÆóÒµ¹ÜÀíÆ÷¡¢²éѯ·ÖÎöÆ÷Öмòµ¥Ö´ÐУ¬Ö±½ÓÁ˵±µÄ²é³öSQL2K¼°SQL2005µÄËùÓÐÊý¾Ý×ֵ䣬·½±ãÎĵµµÄ±àд£¬Ï£Íû¶Ô´ó¼ÒÓаïÖú¡£
¡¡¡¡1. SqlServer2000Êý¾Ý¿â×Öµä--±í½á¹¹.sql
SELECT TOP 100 PERCENT --a.id,
      CASE WHEN a.colorder = 1 THEN d.name ELSE '' END AS ±íÃû,
      CASE WHEN a.colorder = 1 THEN isnull(f.value, '') ELSE '' END AS ±í˵Ã÷,
      a.colorder AS ×Ö¶ÎÐòºÅ, a.name AS ×Ö¶ÎÃû, CASE WHEN COLUMNPROPERTY(a.id,
      a.name, 'IsIdentity') = 1 THEN '√' ELSE '' END AS ±êʶ,
      CASE WHEN EXISTS
          (SELECT 1
         from dbo.sysindexes si INNER JOIN
               dbo.sysindexkeys sik ON si.id = sik.id AND si.indid = sik.indid INNER JOIN
               dbo.syscolumns sc ON sc.id = sik.id AND sc.colid = sik.colid INNER JOIN
               dbo.sysobjects so ON so.name = si.name AND so.xtype = 'PK'
         WHERE sc.id = a.id AND sc.colid = a.colid) THEN '√' ELSE '' END AS Ö÷¼ü,
      b.name AS ÀàÐÍ, a.length AS ³¤¶È, COLUMNPROPERTY(a.id, a.name, 'PRECISION')
      AS ¾«¶È, ISNULL(COLUMNPROPERTY(a.id, a.name, 'Scale'), 0) AS СÊýλÊý,
      CASE WHEN a.isnullable = 1 THEN '√' ELSE '' END AS ÔÊÐí¿Õ, ISNULL(e.text, '')
     


Ïà¹ØÎĵµ£º

SQLServerÊý¾Ý¿âÉè¼Æ±íºÍ×Ö¶Î(ת)

SQL ServerÊý¾Ý¿âÉè¼Æ±íºÍ×Ö¶Î
1. ԭʼµ¥¾ÝÓëʵÌåÖ®¼äµÄ¹Øϵ
¡¡¡¡¿ÉÒÔÊÇÒ»¶ÔÒ»¡¢Ò»¶Ô¶à¡¢¶à¶Ô¶àµÄ¹Øϵ¡£ÔÚÒ»°ãÇé¿öÏ£¬ËüÃÇÊÇÒ»¶ÔÒ»µÄ¹Øϵ£º¼´Ò»ÕÅԭʼµ¥¾Ý¶ÔÓ¦ÇÒÖ»¶ÔÓ¦Ò»¸öʵÌå¡£ÔÚÌØÊâÇé¿öÏ£¬ËüÃÇ¿ÉÄÜÊÇÒ»¶Ô¶à»ò¶à¶ÔÒ»µÄ¹Øϵ£¬¼´Ò»ÕÅԭʼµ¥Ö¤¶ÔÓ¦¶à¸öʵÌ壬»ò¶àÕÅԭʼµ¥Ö¤¶ÔÓ¦Ò»¸öʵÌå¡£ÕâÀïµÄʵÌå¿ÉÒÔÀí½âΪ»ù±¾±í¡£Ã ......

SQLSERVERÍâÁ¬½Ó·û

±íA
tmpA:
id     name
00     Ãû×ÖA
01     Ãû×ÖB
02     Ãû×ÖC
03     Ãû×ÖD
04     Ãû×ÖE
tmpB:
id     class
02     °à¼¶A
06 & ......

ѧϰ£ºÁ½ÖÖSqlServerÊý¾Ý¿âÁ¬½ÓµÄʾÀý´úÂë

1¡¢ÊµÀýÒ»£º
public void SqlConnectionOpen()
{
        SqlConnection myConn=new SqlConnection();
        myConn.ConnectionString="server=(local);database=pubs;Trusted_Connection=yes";
        ......

sqlserver ÖÐÌá¸ß²éѯÐÔÄܵķ½·¨

MS   SQL   Server²éѯÓÅ»¯·½·¨
²éѯËÙ¶ÈÂýµÄÔ­ÒòºÜ¶à£¬³£¼ûÈçϼ¸ÖÖ 
        1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ) 
        2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£ 
& ......

SQLSERVERÊý¾Ý¿â»¹Ô­ÊµÕ½

1£©Ð½¨Êý¾Ý¿âRESTORE
2£©ÔÚ¸ÃÊý¾Ý¿âÉÏÑ¡Ôñ£ºÈÎÎñ->»¹Ô­->Êý¾Ý¿â
3£©ÔÚ»¹Ô­Êý¾Ý¿â-RESTOREµÄ¶Ô»°¿òÖÐ
   Ä¿±êÊý¾Ý¿âÊÇRESTORE
   Ö¸¶¨ÓÃÓÚ»¹Ô­µÄ±¸·Ý¼¯µÄÔ´ºÍλÖÃ->Ô´É豸->Ñ¡Ôñ×îºóÒ»¸öÍêÈ«µÄ±¸·ÝBAKÎļþ
   ¹´Öл¹Ô­CheckBox
4£©Ñ¡Ôñ×óÉϽǵÄÑ¡Ïî
   ÔÚ»¹Ô­Ñ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ