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

SQL¼òÌå·±Ìåת»»º¯Êý´úÂë

ºÜ¶àʱºòÎÒÃÇ¿ÉÄܶ¼ÐèÒªÕâôһ¸ö¼ò·±»¥Ïàת»»µÄSQLº¯Êý£¬½ñÌìÔÚÍøÉÏÕÒµ½µÄ£¬ÊÕ¼¯ÏÂÀ´¡£
ÒÔºóÓÐÁËËü¾ÍʡʶàÀ²¡£²»ÓÃÔÙд³ÌÐòÈ¡³öÀ´×ª»»ºóÔÙ¸üÐÂÊý¾Ý¿âÁË¡£
SQL¼òÌå·±Ìåת»»º¯Êý´úÂ룺
--Éú³ÉÂë±í
if exists (select * from dbo.sysobjects where id = object_id(N'[codetable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [codetable]
GO
declare @j varchar(8000),@f varchar(8000)
select @j='   °¡°¢°£°¤°¥°¦°§°¨°©°ª°«°¬°­°®°¯°°°±°²°³°´°µ°¶°·°¸°¹°º°»°¼°½°¾°¿°À°Á°Â°Ã°Ä°Å°Æ°Ç°È°É°Ê°Ë°Ì°Í°Î°Ï°Ð°Ñ°Ò°Ó°Ô°Õ°Ö°×°Ø°Ù°Ú°Û°Ü°Ý°Þ°ß°à°á°â°ã°ä°å°æ°ç°è°é°ê°ë°ì°í°î°ï°ð°ñ°ò°ó°ô°õ°ö°÷°ø°ù°ú°û°ü°ý°þ±¡±¢±£±¤±¥±¦±§±¨±©±ª±«±¬±­±®±¯±°±±±²±³±´±µ±¶±·±¸±¹±º±»±¼±½±¾±¿±À±Á±Â±Ã±Ä±Å±Æ±Ç±È±É±Ê±Ë±Ì±Í±Î±Ï±Ð±Ñ±Ò±Ó±Ô±Õ±Ö±×±Ø±Ù±Ú±Û±Ü±Ý±Þ±ß±à±á±â±ã±ä±å±æ±ç±è±é±ê±ë±ì±í±î±ï±ð±ñ±ò±ó±ô±õ±ö±÷±ø±ù±ú±û±ü±ý±þ²¡²¢²£²¤²¥²¦²§²¨²©²ª²«²¬²­²®²¯²°²±²²²³²´²µ²¶²·²¸²¹²º²»²¼²½²¾²¿²À²Á²Â²Ã²Ä²Å²Æ²Ç²È²É²Ê²Ë²Ì²Í²Î²Ï²Ð²Ñ²Ò²Ó²Ô²Õ²Ö²×²Ø²Ù²Ú²Û²Ü²Ý²Þ²ß²à²á²â²ã²ä²å²æ²ç²è²é²ê²ë²ì²í²î²ï²ð²ñ²ò²ó²ô²õ²ö²÷²ø²ù²ú²û²ü²ý²þ³¡³¢³£³¤³¥³¦³§³¨³©³ª³«³¬³­³®³¯³°³±³²³³³´³µ³¶³·³¸³¹³º³»³¼³½³¾³¿³À³Á³Â³Ã³Ä³Å³Æ³Ç³È³É³Ê³Ë³Ì³Í³Î³Ï³Ð³Ñ³Ò³Ó³Ô³Õ³Ö³×³Ø³Ù³Ú³Û³Ü³Ý³Þ³ß³à³á³â³ã³ä³å³æ³ç³è³é³ê³ë³ì³í³î³ï³ð³ñ³ò³ó³ô³õ³ö³÷³ø³ù³ú³û³ü³ý³þ´¡´¢´£´¤´¥´¦´§´¨´©´ª´«´¬´­´®´¯´°´±´²´³´´´µ´¶´·´¸´¹´º´»´¼´½´¾´¿´À´Á´Â´Ã´Ä´Å´Æ´Ç´È´É´Ê´Ë´Ì´Í´Î´Ï´Ð´Ñ´Ò´Ó´Ô´Õ´Ö´×´Ø´Ù´Ú´Û´Ü´Ý´Þ´ß´à´á´â´ã´ä´å´æ´ç´è´é´ê´ë´ì´í´î´ï´ð´ñ´ò´ó´ô´õ´ö´÷´ø´ù´ú´û´ü´ý´þµ¡µ¢µ£µ¤µ¥µ¦µ§µ¨µ©µªµ«µ¬µ­µ®µ¯µ°µ±µ²µ³µ´µµµ¶µ·µ¸µ¹µºµ»µ¼µ½µ¾µ¿µÀµÁµÂµÃµÄµÅµÆµÇµÈµÉµÊµËµÌµÍµÎµÏµÐµÑµÒµÓµÔµÕµÖµ×µØµÙµÚµÛµÜµÝµÞµßµàµáµâµãµäµåµæµçµèµéµêµëµìµíµîµïµðµñµòµóµôµõµöµ÷µøµùµúµûµüµýµþ¶¡¶¢¶£¶¤¶¥¶¦¶§¶¨¶©¶ª¶«¶¬¶­¶®¶¯¶°¶±¶²¶³¶´¶µ¶¶¶·¶¸¶¹¶º¶»¶¼¶½¶¾¶¿¶À¶Á¶Â¶Ã¶Ä¶Å¶Æ¶Ç¶È¶É¶Ê¶Ë¶Ì¶Í¶Î¶Ï¶Ð¶Ñ¶Ò¶Ó¶Ô¶Õ¶Ö¶×¶Ø¶Ù¶Ú¶Û¶Ü¶Ý¶Þ¶ß¶à¶á¶â¶ã¶ä¶å¶æ¶ç¶è¶é¶ê¶ë¶ì¶í¶î¶ï¶ð¶ñ¶ò¶ó¶ô¶õ¶ö¶÷¶ø¶ù¶ú¶û¶ü¶ý¶þ·¡·¢·£·¤·¥·¦·§·¨·©·ª·«·¬·­·®·¯·°·±·²·³·´·µ·¶···¸·¹·º·»·¼·½·¾·¿·À·Á·Â·Ã·Ä·Å·Æ·Ç·È·É·Ê·Ë·Ì·Í·Î·Ï·Ð·Ñ·Ò·Ó·Ô·Õ·Ö·×·Ø·Ù·Ú·Û·Ü·Ý·Þ·ß·à·á·â·ã·ä·å·æ·ç·è·é·ê·ë·ì·í·î·ï·ð·ñ·ò·ó·ô·õ·ö·÷·ø·ù·ú·û·ü·ý·þ¸¡¸¢¸£¸¤¸¥¸¦¸§¸¨¸©¸ª¸«¸¬¸­¸®¸¯¸°¸±¸²¸³¸´¸µ¸¶¸·¸¸¸¹¸º¸»¸¼¸½¸¾¸¿¸À¸Á¸Â¸Ã¸Ä¸Å¸Æ¸Ç¸È¸É¸Ê¸Ë¸Ì¸Í¸Î¸


Ïà¹ØÎĵµ£º

ÔÚc#ÖеÄÈ¡µÃsql´æ´¢¹ý³ÌµÄoutput²ÎÊý

һֱûÓÐÕÒµ½Ò»Öֺõķ½·¨À´ÒýÓÃÓзµ»ØÖµµÄ´æ´¢¹ý³ÌµÄ·½·¨£¬Ê¹ÎÒÔÚÌí¼ÓÊý¾ÝÖÐ×ßÁ˲»ÉÙµÄÍä·£¬×î½ü£¬ÔÚ²éÔÄÁË´óÁ¿µÄ×ÊÁÏÖ®ºó£¬ÖÕÓÚÔÚ΢ÈíµÄÒ»¸öʵÀýÖÐÕÒµ½ÁËÒ»ÖÖÁ¼ºÃµÄ·½·¨¡£
Ê×ÏȱàдºÃÒ»Óзµ»ØÖµµÄ´æ´¢¹ý³Ì
create procedure proc_name
   @para1 nchar(20),    --ÊäÈë²ÎÊý
   @ ......

½â¾ö sql server 2005 expressÖÐsa²»ÄܵǼ

1.ʹÓÃManagement Studio Express£¬ÓÓWindowsÉí·ÝÑéÖ¤”µÇ¼£¬Ñ¡ÖÐSQL·þÎñÆ÷Ãû£¬ÓÒ»÷Êó±êÑ¡ÔñÊôÐÔ£¬ÔÚ·þÎñÆ÷ÊôÐÔÑ¡ÏîÒ³Ã棬ѡÔñ“°²È«ÐÔ”£¬½«·þÎñÆ÷Éí·ÝÑéÖ¤ÓÉ “WindowsÉí·ÝÑéÖ¤”¸ÄΪ“SQL ServerºÍWindowsÉí·ÝÑéÖ¤”£¬µ¥»÷È·¶¨¡£
2.ʹÓÃSQL Server 2005ÍâΧӦÓÃÅäÖÃÆ÷£¬Ñ¡ ......

ʵÏÖ¶àÐкϲ¢Ò»ÐеÄSQL [MSSQL2005]д·¨

--1. ´´½¨±í£¬Ìí¼Ó²âÊÔÊý¾Ý
CREATE TABLE tb(id int, [value] varchar(10))
INSERT tb SELECT 1, 'aa'
UNION ALL SELECT 1, 'bb'
UNION ALL SELECT 2, 'aaa'
UNION ALL SELECT 2, 'bbb'
UNION ALL SELECT 2, 'ccc'
--SELECT * from tb
/**//*
id value
----------- ----------
1 aa
1 bb
2 aaa ......

SQL ServerѧϰµÚÒ»Ìì

     SQL Server7.0Êý¾Ý¿â£ºÊý¾Ý²Ö¿â¡¢Êý¾Ý¸´ÖÆ¡¢·Ö²¼Ê½Êý¾Ý¿âÓ¦ÓóÌÐò¡¢IntelnetºÍIntranetÓ¦Óú͹ÜÀí¹¤¾ß£»
°²×°¼ì²â£º1¡¢net start mssqlsever;
               2¡¢osql /usa /p  ;
      ......

ÔÚVB2008 ËٳɰæÖÐʹÓòÎÊý»¯SQL²éѯÓï¾äÎÞЧ

  ×î½ü¸Õѧ»áÔÚVB2008 ÖÐʹÓòÎÊý»¯SQLÓï¾ä£¬ÓÚÊÇÂíÉÏÓõ½´úÂëÖУ¬È´Åöµ½²é²»µ½ÈκÎÊý¾ÝµÄÇé¿ö£¬¾À½áÁ˺ü¸Ì죬»¹ÊÇûÓиãÃ÷°×£¬²îµãÍÂѪ¡£²»µÃÒÑ»¹ÊÇÏÈÔÚ´úÂëÖÐʹÓÃ×Ö·û´®Æ´½ÓµÄSQLÓï¾ä¡£
  °üº¬²ÎÊý»¯SQLÓï¾äµÄ´úÂëÈçÏ£º
            Dim cmSl As N ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ