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

sqlÖеÄÓαê

declare @id varchar(10)
declare @nm varchar(10)
declare @table as table(emp varchar(10),empname varchar(10))
declare CurEmp cursor for select top 6 empid,empname from employee
open CurEmp
fetch next from CurEmp into @id,@nm
While @@fetch_status=0
 begin
  insert @table(emp,empname) values(@id,@nm)
  fetch next from CurEmp into @id,@nm
 end
close CurEmp
deallocate CurEmp
select * from @table
Èç¹ûÐèÒª´Óijһ½á¹û¼¯ÖÐÖðÒ»µØ¶ÁÈ¡Ò»Ìõ¼Ç¼£¬¿ÉÒÔÓÃÓαêʵÏÖ£¬ÉÏÃæÊǸö¼òµ¥µÄÀý×Ó


Ïà¹ØÎĵµ£º

SQL Server CLRÈ«¹¦ÂÔÖ®Îå

Ò»¡¢ÕâÊÇÕâ¸öϵÁеÄ×îºóÒ»½ÚÁË£¬×Ô¶¨Ò帴ÔÓÊý¾ÝÀàÐÍÄ¿Ç°Ö»ÄÜͨ¹ýCLRÀ´ÊµÏÖ¡£ÎªÁËÔÚ SQL Server ÖÐÔËÐУ¬ÄúµÄ UDT ±ØÐëʵÏÖ UDT ¶¨ÒåÖеÄÒÔÏÂÒªÇó£º
1.¸Ã UDT ±ØÐëÖ¸¶¨ Microsoft.SqlServer.Server.SqlUserDefinedTypeAttribute¡£System.SerializableAttribute ¿ÉÑ¡Ó㬵«½¨ÒéʹÓá£
2.UDT ±ØÐëͨ¹ý´´½¨¹«¹²µÄ static£¨M ......

SQL SERVER 2005 °²×°´íÎó½â¾öÁË~

½ñÌìÔÚһ̨Ðé»úÉÏ°²×° sql server 2005£¬¾ÓÈ»±¨1´íÁË£¨ÎÞÓïÁË£¬×°Õâ¸ö¶«Î÷¶¼Åª²»ºÃ%>_<%£©¿ªÊ¼ÒÔΪÊÇÒòΪADÓòµÄÔ­Òò£¬ºóÀ´É¾µôÓòÓÖÖؽ¨Óò£¬È»ºóÔÙ×°£¬ÓÖ±¨2´í£¬ÓÚÊÇÎʱðÈËËÑË÷µÈµÈ£¬ÕÒµ½Ô­Òò˵ҪÖØÐÂ×¢²áinstaller£¬×îÖÕ°²×°³É¹¦ÁË£¬º¦ÎÒ¼Ó°àŪµÄ£¬¸ßÐ˵ÄÊÇ°²×°ºÃÀ²£¬¿ÉÊÇÎÒûÓÐŪÃ÷°×µ½µ×ÊÇɶԭÒòµ¼ÖÂsql°²×°²»ÁËÄØ£ ......

PB Êý¾Ý¿âÁ¬½ÓÒÔ¼°sqlÓï¾äÔËÐÐÐÅÏ¢·µ»Ø´úÂë½âÊÍ´óÈ«


Èç¹ûÒ»¸ö SQL Óï¾ä·¢ÉúÁË´íÎó£¬ÄÇô sqlca.sqlcode ½«ÊÇ·ÇÁãÖµ¡£
Èç¹û sqlca.sqlcode СÓÚ 0 ÄÇô¾ÍÊÇ·¢ÉúÁËijÖÖÑÏÖصĴíÎó£¬ÏóÊý¾Ý¿â¶¨ÒåÓë²éѯ¶¨Òå²»Ò»Öµȣ®
Èç¹û´óÓÚ 0 ÔòÊÇͨ³£µÄ´íÎó£¬Ïó±í²»°üÀ¨ËùÒªÇóµÄÐеȣ®
sqlca.sqlcode == 0£¬³É¹¦
sqlca.sqlcode == -1 ʧ°Ü     £¨»ñÈ¡¾ßÌåʧ°ÜÐÅÏ¢ ......

SQLʹÓÃС½á

1. Èç¹ûÄãÏ£ÍûʹÓÃselcet topÓï¾ä£¬²¢ÇÒ»¹Òª¸½´øwhereÌõ¼þ£¬ÄÇôÌõ¼þÖеÄÁо͵ÃÊǺÏÊʵÄË÷Òý£¬Èç¾Û¼¯Ë÷Òý¡¢¸´ºÏË÷ÒýÀïµÄÖ÷ÁÐ
 µÈ£¬Í¬Ê±£¬whereÌõ¼þÀïÒ²Òª¾¡Á¿±Ü¿ªÊ¹Óú¯Êý£¬or£¬ÅжÏNULLµÈ»áÒýÆðÈ«²¿É¨ÃèµÄÓï¾ä£¬²»È»Ö´ÐеÄÊÇÈ«±íɨÃè¡£
2. ͨ¹ýÉèÖÃSTATISTICSÎÒÃÇ¿ÉÒԲ鿴ִÐÐSQLʱµÄÖ´ÐÐЧÂÊÒÔ¼°Ïà¹ØÐÔÄܲâÊÔ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ