¹ØÓÚmysqlÖд¥·¢Æ÷Ö´Ðж¯Ì¬sqlµÄÎÊÌâ
Õ⼸ÌìÊÖÍ·¿ª·¢µÄϵͳҪ×öÒ»¸öÀàËÆwindowsÕË»§µ½ÆÚʱ¼äµÄ¹¦ÄÜ£¬¿¼ÂÇÁË°ëÌìÏë³öÁËÒ»¸ö¼¼ÊõÉϺÍÂß¼É϶¼»¹ÄÜʵÏֵĽâ¾ö·½°¸£º
´´½¨Ò»¸öÓû§´æÈëÊý¾Ý¿âµÄʱºò¶¼´´½¨Ò»¸öʼþµ÷¶ÈÆ÷À´¿ØÖÆÓû§µÄµ½ÆÚʱ¼ä£¨mysqlµÄʱ¼äµ÷¶ÈÆ÷ȷʵºÜ·½±ã£©¡£ÏëÆðÀ´ÊǺܼòµ¥£¬µ«ÊÇ×öÆðÀ´ÎÊÌâȷʵһ²¨½ÓÒ»²¨...
һЩСÎÊÌâ¾Í²»ËµÁË£¬µ½Á˹ؼüµÄµØ·½ÁË£ºÔÚ²åÈëÒ»¸öÓû§µÄʱºòÎÒµ½µ×ÊÇÔÚÓ¦ÓòãÀ´Ìí¼ÓÒ»¸öʼþµ÷¶ÈÆ÷ÄØ»¹ÊÇÔÚÊý¾Ý¿âÀïÃæ×Ô¶¯Ìí¼Ó¡£
µ±È»²»¹Ü´Ó´úÂëµÄÃÀ¹ÛÉÏ¡¢ÏµÍ³Éè¼ÆµÄ˼ÏëÉÏ»òÊÇÔËÐÐЧÂÊÉÏÀ´Ëµ£¬ÎÒ¶¼Ó¦¸ÃÑ¡ÔñºóÕߣ¨·Ï»°...£©¡£ÓÚÊÇÎÒ¾ÍÑ¡ÔñÁ˺óÕߣ¨Äã¸ÒÔÙ˵·Ï»°Â𣩡£ÄÇô¾ÍÓÐÁ˽ñÌìµÄÕâ¶Î±Ê¼Ç...
Ò»¿ªÊ¼ÎÒÐËÖ²ª²ªµÄÆ´ºÃ×Ö·û´®Ê²Ã´µÄ£¬Ð´ÁËÈçÏÂÒ»¸ö´¥·¢Æ÷
delimiter //
create trigger tri_user after insert on user for each row
begin
set @u_name = new.u_name;
set @expire = '';
select sm_pwd_alter_day into @expire from system_manage where sm_id = 1;
set @str = concat('create EVENT eve_', @u_name, ' ON SCHEDULE EVERY ', @expire, ' day DO
update user set u_enable = \'δÆôÓÃ\' where u_name = \'', @u_name, '\'');
prepare stmt_str from @str;
execute stmt_str;
DEALLOCATE PREPARE stmt_str;
end;
//
delimiter ;
×Ðϸ¼ì²éÁËÓï·¨£¬È»ºóÐ˸߲ÉÁÒµÄÔËÐÐ...£¨orz£©½á¹ûÈ´ÊÇÏÂÃæÕâÐдíÎóÌáʾ£º
“Dynamic SQL is not allowed in stored function or trigger”
my god£¬ÔÀ´mysqlµÄ´¥·¢Æ÷²»Ö§³Ö¶¯Ì¬sql£¬ÓÚÊÇÉÏÍøbaiduÑ°ÕÒÌæ´ú·½·¨£¬ÎÞ¹û£¬
È»ºógoogle£¬·½·¨³öÏÖ£ºÓÐÈËÒ²Óöµ½ÁË´¥·¢Æ÷ÀïÖ´Ðж¯Ì¬sqlµÄÎÊÌ⣬Ȼºó·¢Ìû£¬ºóÃæ¸ßÊÖ½â´ð˵
°Ñ¶¯Ì¬sqlÓï¾ä´«Èë´æ´¢¹ý³ÌÀȻºóÔÚ´¥·¢Æ÷Àïµ÷Óô洢¹ý³Ì¾Í¿ÉÒÔÁË¡£È»ºóÄÇλ¥Ö÷»¹¸øÁ˸ßÊÖ
70·Ö£¨±¯¾ç,ºóÃæ˵£©...ÎÒÏëÕâ´Îµ½Î»ÁË¡£ÓÚÊÇÄ£·ÂÖ®¡¢ÓÚÊÇÔËÐÐÖ®¡¢ÓÚÊdzöÏÖ½á¹û£º
“Dynamic SQL is not allowed in stored function or trigger”
ÎÔ²Û...»¹ÊÇÕâ¸ö½á¹û...
ÓÚÊÇÎÒÃ÷°×Á˽áÁËÌùµÄÒ²²»Ò»¶¨ÊÇÕýÈ·´ð°¸¡£
ÄÇôÎÒÒÔΪ´æ´¢¹ý³ÌÀïÔËÐж¯Ì¬sql£¬È»ºó´¥·¢Æ÷ÔÙµ÷ÓÃÕâ¸ö´æ´¢¹ý³Ì£¬»¹ÊÇÏ൱ÓÚÔÚ´¥·¢Æ÷ÀïÔËÐж¯Ì¬sql¡£
²»ÏëÔÙÈ¥ÉÁË£¬»¹ÊÇÀÏÀÏʵʵÔÚÓ¦Óó̽â¾öÕâ¸öÎÊÌâÁË¡£
Ïà¹ØÎĵµ£º
ÕûÀíÁËÒÔÏÂËÄÖÖÔÚMySQLÖÐÐÞ¸ÄrootÃÜÂëµÄ·½·¨,¿ÉÄܶԴó¼ÒÓÐËù°ïÖú
·½·¨1£º ÓÃSET PASSWORDÃüÁî
¡¡¡¡mysql -u root
¡¡¡¡mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
·½·¨2£ºÓÃmysqladmin
¡¡¡¡mysqladmin -u root password "newpass"
¡¡¡¡Èç¹ûrootÒѾÉèÖùýÃÜÂ룬²ÉÓÃÈçÏ·½·¨
¡¡¡¡mysql ......
ÔÚwindowsÏÂ
£º
Æô¶¯£º
1.cd c:\mysql\bin
2.mysqld --console
¹Ø±Õ£º
1.cd c:\mysql\bin
......
IN expireDate VARCHAR(20),IN resType INT
//-----------------------------------------------------------------------------------
BEGIN
DECLARE a,b,icon_id INT;
DECLARE cur_1 CURSOR FOR SELECT id from `tbl_resource` WHERE discriminator="RC_CON" and robot_type=resType and add_date<=ex ......
ÎÊÌâ
ÈçºÎÈÃT-SQL²âÊÔÌ×¼þ°Ñ²âÊÔÓÃÀý½á¹ûÖ±½ÓдÈëÎı¾Îļþ
Éè¼Æ
ʹÓÃActiveX¼¼ÊõʵÀý»¯Ò»¸öFileSystemObject¶ÔÏó£¬È»ºóͨ¹ýOpenTextFile()ºÍWriteLine()·½·¨Ö±½Ó°Ñ²âÊÔ½á¹ûдÈëÎļþ¡£
·½°¸
declare @fsoHandle int,@fileID int
exec sp_OACreate 'Scr ......
1. SQLÓÅ»¯µÄÔÔòÊÇ£º
½«Ò»´Î²Ù×÷ÐèÒª¶ÁÈ¡µÄBLOCKÊý¼õµ½×îµÍ,¼´ÔÚ×î¶ÌµÄʱ¼ä´ïµ½×î´óµÄÊý¾ÝÍÌÍÂÁ¿¡£
µ÷Õû²»Á¼SQLͨ³£¿ÉÒÔ´ÓÒÔϼ¸µãÇÐÈ룺
¼ì²é²»Á¼µÄSQL£¬¿¼ÂÇÆäд·¨ÊÇ·ñ»¹ÓпÉÓÅ»¯ÄÚÈÝ
¼ì²é×Ó²éѯ ¿¼ÂÇSQL×Ó²éѯÊÇ·ñ¿ÉÒÔÓüòµ¥Á¬½Óµ ......