SQL Server 2005/2008Êý¾Ý¿âÓʼþ
Æô¶¯Êý¾Ý¿âÓʼþ¹¦ÄÜ
sp_configure 'show advanced', 1;
GO
RECONFIGURE;
GO
sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE;
GO
-- ÅäÖÃÊý¾Ý¿âÓʼþ
-- Ìí¼ÓÓʼþÕË»§
execute msdb.dbo.sysmail_add_account_sp
@account_name = 'ÓÊÏäÕÊ»§Ãû(Ëæ±ãÈ¡Ò»¸ö£¬±£³ÖºÍÏÂÎÄÒ»Ö¼´¿É)',
@description = 'mail account for db e-mail.',
@email_address = 'ÄãµÄÓÊÏäµØÖ·',
@replyto_address = 'ÄãµÄÓÊÏäµØÖ·',
@display_name = '·¢ÐÅʱÏÔʾµÄÓû§ÃûêdzÆ',
@mailserver_name = 'ÓÊÏä·þÎñÆ÷,Èçsmtp.163.com',
@port = 25,
@username = 'ÓÊÏäµÄÕË»§',
@password = 'ÓÊÏäµÄÃÜÂë',
@use_default_credentials = 0;
-- ´´½¨Êý¾Ý¿âÓʼþÅäÖÃÎļþ
execute msdb.dbo.sysmail_add_profile_sp
@profile_name = 'ÅäÖÃÎļþÃû(Ëæ±ãÈ¡Ò»¸ö£¬±£³ÖºÍÏÂÎÄÒ»Ö¼´¿É)',
@description = 'profile used for sql server mail.';
-- ΪÊý¾Ý¿âÅäÖÃÎļþÌí¼ÓÓʼþÕË»§
execute msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'ÅäÖÃÎļþÃû(ͬÉÏ)',
@account_name = 'ÓÊÏäÕÊ»§Ãû(ͬÉÏ)',
@sequence_number = 1 ;
-- ÐÞ¸ÄÊý¾Ý¿âÅäÖÃÎļþµÄ°²È«ÐÔ: ÊÇ·ñ¹«ÓÃ
execute msdb.dbo.sysmail_add_principalprofile_sp
@principal_name = 'public',
@profile_name = 'ÅäÖÃÎļþÃû(ͬÉÏ)',
@is_default = 1 ;
-- Ð޸IJÎÊý: Óʼþ·¢ËÍʧ°Üʱ³¢ÊÔÖØ·¢´ÎÊý
execute msdb.dbo.sysmail_configure_sp
'AccountRetryAttempts', 3;
-- Ð޸IJÎÊý: Óʼþ·¢ËÍʧ°Üʱ³¢ÊÔÖØ·¢Ê±, ÑÓʱÃëÊý
execute msdb.dbo.sysmail_configure_sp
'AccountRetryDelay', 120;
-- Ð޸IJÎÊý: ÍⲿÓʼþ½ø³Ì±£³Ö»î¶¯×´Ì¬µÄ×îÉÙʱ¼ä£¨ÒÔÃëΪµ¥Î»£©¡£Èç¹ûÊý¾Ý¿âÓʼþÒª·¢ËͶà¸öÓʼþ£¬Ôö¼Ó´ËÖµ¿ÉÒÔʹÊý¾Ý¿âÓʼþ±£³Ö»î¶¯×´Ì¬£¬±ÜÃâƵ·±Æô¶¯ºÍ
Ïà¹ØÎĵµ£º
1.ÔÚmssql´´½¨´æ´¢¹ý³Ì,ÔÚdb->´æ´¢¹ý³Ì->н¨´æ´¢¹ý³Ì(ÓÒ¼ü)
CREATE PROCEDURE user_logon_check @username varchar(45),@userpsw varchar(45)
AS
select * from users where UserName = @username and PasswordCode = @userpsw
return 10
GO
2.ÔÚmysql´´½¨´æ´¢¹ý³Ì,ʹÓÃMysql Query Browser,ÔÚdb->±í ......
¼¸¸ö´æ´¢¹ý³Ì£¬ºÜ¼òµ¥µÄ£¬µ«ÊÇÎÒ´ÓÀ´Ã»ÓÐѧϰ¹ý£¬ºÇºÇ£¬Õâ¸öÕýÊÇÎÒÒªÀ´ÅàѵµÄÄ¿µÄ
-- =============================================
-- Author:
-- Create date: 2010Äê05ÔÂ12ÈÕ
-- Description: ´Ë¹ý³ÌÓÃÓÚ²éѯËùÓÐÓû§Ãû¼°ÃÜÂë
-- =============================================
CREATE PROCED ......
»ù±¾µÄSql±àдעÒâÊÂÏî
¾¡Á¿ÉÙÓÃIN²Ù×÷·û£¬»ù±¾ÉÏËùÓеÄIN²Ù×÷·û¶¼¿ÉÒÔÓÃEXISTS´úÌæ¡£
²»ÓÃNOT IN²Ù×÷·û£¬¿ÉÒÔÓÃNOT EXISTS»òÕßÍâÁ¬½Ó+Ìæ´ú¡£
OracleÔÚÖ´ÐÐIN×Ó²éѯʱ£¬Ê×ÏÈÖ´ÐÐ×Ó²éѯ£¬½«²éѯ½á¹û·ÅÈëÁÙʱ±íÔÙÖ´ÐÐÖ÷²éѯ¡£¶øEXISTÔòÊÇÊ×Ïȼì²éÖ÷²éѯ£¬È»ºóÔËÐÐ×Ó²éѯֱµ½ÕÒµ½
µÚÒ»¸öÆ¥ÅäÏî¡£NOT EXISTS±ÈNOT INЧÂÊÉ ......
SQLÓï¾ä¼¶±ðµÄÓÅ»¯ÊÇÎÒÃÇʵ¼Ê¹¤×÷ÖнӴ¥×î¶àµÄ£¬¼¸ºõËùÓеÄÊý¾Ý¿âÓ¦ÓÃ˵µ½µ×¶¼ÊÇSQLÓï¾äµÄ¾ßÌåÖ´ÐУ¬Òò´ËÈçºÎ¶ÔSQL½Å±¾±¾Éí½øÐÐÓÅ»¯£¬Ìá¸ßÖ´ÐÐЧÂʾÍÏÔµÃÓÈΪÖØÒª¡£ÒÔÏÂÊÇһЩͨÓõÄÉè¼ÆÔÔò¡£
(1)ʹÓÃselectÓï¾ä²éѯʱ£¬¾¡Á¿²»ÒªÊ¹ÓÃselect *¡¡Óï¾ä£¬¶øÊÇÓ¦¸ÃÖ¸Ã÷¾ßÌåÒª²éѯµÄ×ֶΣ¬ÌáÈ¡µÄ×Ö¶ÎÊýÁ¿Ô½É ......