sql´æ´¢¹ý³ÌѧϰʵÀý
ʲôÊÇ´æ´¢¹ý³ÌÄØ£¿
¡¡¡¡¶¨Ò壺
¡¡¡¡½«³£ÓõĻòºÜ¸´ÔӵŤ×÷£¬Ô¤ÏÈÓÃSQLÓï¾äдºÃ²¢ÓÃÒ»¸öÖ¸¶¨µÄÃû³Æ´æ´¢ÆðÀ´, ÄÇôÒÔºóÒª½ÐÊý¾Ý¿âÌṩÓëÒѶ¨ÒåºÃµÄ´æ´¢¹ý³ÌµÄ¹¦ÄÜÏàͬµÄ·þÎñʱ,Ö»Ðèµ÷ÓÃexecute,¼´¿É×Ô¶¯Íê³ÉÃüÁî¡£
¡¡¡¡½²µ½ÕâÀï,¿ÉÄÜÓÐÈËÒªÎÊ£ºÕâô˵´æ´¢¹ý³Ì¾ÍÊÇÒ»¶ÑSQLÓï¾ä¶øÒÑ°¡£¿
¡¡¡¡Microsoft¹«Ë¾ÎªÊ²Ã´»¹ÒªÌí¼ÓÕâ¸ö¼¼ÊõÄØ?
¡¡¡¡ÄÇô´æ´¢¹ý³ÌÓëÒ»°ãµÄSQLÓï¾äÓÐʲôÇø±ðÄØ?
¡¡¡¡´æ´¢¹ý³ÌµÄÓŵ㣺
¡¡¡¡1.´æ´¢¹ý³ÌÖ»ÔÚ´´Ôìʱ½øÐбàÒ룬ÒÔºóÿ´ÎÖ´Ðд洢¹ý³Ì¶¼²»ÐèÔÙÖØбàÒ룬¶øÒ»°ãSQLÓï¾äÿִÐÐÒ»´Î¾Í±àÒëÒ»´Î,ËùÒÔʹÓô洢¹ý³Ì¿ÉÌá¸ßÊý¾Ý¿âÖ´ÐÐËٶȡ£
¡¡¡¡2.µ±¶ÔÊý¾Ý¿â½øÐи´ÔÓ²Ù×÷ʱ(Èç¶Ô¶à¸ö±í½øÐÐUpdate,Insert,Query,Deleteʱ£©£¬¿É½«´Ë¸´ÔÓ²Ù×÷Óô洢¹ý³Ì·â×°ÆðÀ´ÓëÊý¾Ý¿âÌṩµÄÊÂÎñ´¦Àí½áºÏÒ»ÆðʹÓá£
¡¡¡¡3.´æ´¢¹ý³Ì¿ÉÒÔÖظ´Ê¹ÓÃ,¿É¼õÉÙÊý¾Ý¿â¿ª·¢ÈËÔ±µÄ¹¤×÷Á¿
¡¡¡¡4.°²È«ÐÔ¸ß,¿ÉÉ趨ֻÓÐij´ËÓû§²Å¾ßÓжÔÖ¸¶¨´æ´¢¹ý³ÌµÄʹÓÃȨ
¡¡¡¡´æ´¢¹ý³ÌµÄÖÖÀࣺ
¡¡¡¡1.ϵͳ´æ´¢¹ý³Ì£ºÒÔsp_¿ªÍ·,ÓÃÀ´½øÐÐϵͳµÄ¸÷ÏîÉ趨.È¡µÃÐÅÏ¢.Ïà¹Ø¹ÜÀí¹¤×÷,Èç sp_help¾ÍÊÇÈ¡µÃÖ¸¶¨¶ÔÏóµÄÏà¹ØÐÅÏ¢
¡¡¡¡2.À©Õ¹´æ´¢¹ý³Ì ÒÔXP_¿ªÍ·,ÓÃÀ´µ÷ÓòÙ×÷ϵͳÌṩµÄ¹¦ÄÜ
¡¡¡¡exec master..xp_cmdshell 'ping 10.8.16.1'
¡¡¡¡3.Óû§×Ô¶¨ÒåµÄ´æ´¢¹ý³Ì,ÕâÊÇÎÒÃÇËùÖ¸µÄ´æ´¢¹ý³Ì
¡¡¡¡³£Óøñʽ
Create procedure procedue_name
[@parameter data_type][output]
[with]{recompile|encryption}
as
ql_statement
¡¡¡¡½âÊÍ:
¡¡¡¡output£º±íʾ´Ë²ÎÊýÊÇ¿É´«»ØµÄ
¡¡¡¡with {recompile|encryption}
¡¡¡¡recompile:±íʾÿ´ÎÖ´Ðд˴洢¹ý³Ìʱ¶¼ÖØбàÒëÒ»´Î
¡¡¡¡encryption:Ëù´´½¨µÄ´æ´¢¹ý³ÌµÄÄÚÈݻᱻ¼ÓÃÜ
¡¡¡¡Èç:
¡¡¡¡±íbookµÄÄÚÈÝÈçÏÂ
±àºÅ ÊéÃû ¼Û¸ñ
001 CÓïÑÔÈëÃÅ $30
002 PowerBuilder±¨±í¿ª·¢ $52
¡¡¡¡ÊµÀý1:²éѯ±íBookµÄÄÚÈݵĴ洢¹ý³Ì
create proc query_book
as
select * from book
go
exec query_book
¡¡¡¡ÊµÀý2:¼ÓÈëÒ»±Ê¼Ç¼µ½±íbook,²¢²éѯ´Ë±íÖÐËùÓÐÊé¼®µÄ×ܽð¶î
Create proc insert_book
@param1 char(10),@param2 varchar(20),@param3 money,@param4 money output
with encryption ---------¼ÓÃÜ
as
insert book(±àºÅ,ÊéÃû£¬¼Û¸ñ£© Values(@param1,@param2,@param3)
select @param4=sum(¼Û¸ñ) from book
go
¡¡¡¡Ö´ÐÐÀý×Ó:
declare @total_price money
exec insert_book '003','Delphi ¿Ø¼þ¿ª·¢Ö¸ÄÏ',$100,@total_price
p
Ïà¹ØÎĵµ£º
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CR ......
ÏÂÎçÏòÊý¾Ý¿âSQL SERVERÖÐÓöµ½Ìí¼ÓͼƬÀàÐÍÊý¾ÝµÄÎÊÌ⣬±¾ÒÔΪÔÚ½çÃæ¹ÜÀíÆ÷ÖпÉÒÔÖ±½Ó£¨Í¨¹ýÖ¸¶¨Â·¾¶°ÑͼƬµÄÊý¾Ý±£´æÆðÀ´£©Ìí¼ÓͼƬȴ²»È»¡£ÍøÉÏËÑÁËÏÂÕÒµ½ÁËÏà¹ØµÄ½ÏרҵµÄ×ÊÁÏ£¬ÕûºÏ½â¶Áһϣº Á½ÖÖ·½·¨£º µÚÒ»¾ÍÊÇÔÚÊý¾Ý¿âÖд洢ͼƬµÄ·¾¶£¬È»ºóÔÚ³ÌÐòÖиù¾Ý¶ÁÈ¡µÄ·¾¶¶ÁȡͼƬ£»ÕâÖ ......
µÚÒ»ÖÖ°ì·¨£ºÏÈÑ¡Öгö´íµÄÊý¾Ý¿â→Ñ¡ÖÐÒÔºóÓÒ¼üµã»÷ÊôÐԻᵯ³öÊý¾Ý¿âÊôÐÔ ¶Ô»°¿ò→Ñ¡ÖÐÊý¾Ý¿âÊôÐÔ¶Ô»°¿òÖеÄÑ¡Ïî→°ÑÑ¡ÏîÖеÄÅÅÐò¹æÔòÉèÖóÉ:Chinese_PRC_90_CI_AS→×îºóµã»÷È·¶¨¼´¿É¡£
£¨×¢Ò⣺ÔÚÑ¡ÔñÊý¾Ý¿âÊôÐÔµÄʱºò±ØÐëÈ·±£ÄãËùÐ޸ĵÄÊý¾Ý¿âδ±»Ê¹ÓòſÉÒÔÐ޸ķñÔò»áʧ°ÜµÄ£©
µÚ¶þÖÖ°ì·¨£ºÊ×ÏÈ´ò¿ªÄã ......
ת×Ô£ºhttp://blog.csdn.net/oceanrain/archive/2006/09/26/1289188.aspx
±¾ÎÄÖ÷Òª½éÉÜͨ¹ýSQL Server2005Á¬½ÓExcelºÍAccess,È»ºó·ÃÎÊExcel¹¤×÷²¾ÖеÄÄÚÈݼ°Access±¾µØÊý¾Ý¿âÖеıíÄÚÈݵķ½·¨:
Ò».SQL Server2005ÈçºÎ·ÃÎÊExcelÎļþÖеÄÊý¾Ý£¿
1.ÔËÐÐ"¿ªÊ¼ \ ³ÌÐò \ Microsoft SQL Server 2005 \ SQL Server Manage ......
¸ãÁ˺ܾᣡ£ÖÕÓÚ·¢ÏÖÔÀ´ÊÇȨÏÞÎÊÌâ¡£¡£
2ÐÐÃüÁî¸ã¶¨
grant all privileges on rogue.* to admin@localhost identified by 'admin' with grant option
grant all privileges on rogue.* to admin@'%' identified by 'admin' with grant option
¾µäÁË¡£¡£¡£
ħÁ¦Ë½·þÍøÒ³¶Ë¸ã¶¨¿©~~ ......