日期:2014-05-18  浏览次数:20511 次

SQL实现查找关键字
如下是runlog日志,需要根据日志中关键字“CLOY_PROMO_ITEMS”,查出来后面PROMO_ID = 7226 这个值。
用sql语句实现,望各位帮忙!谢谢


 8:43:22 12/06/11
 8:43:22 #PSP SRefresh: Loyalty promotion on total [7225] processed.
 8:43:22 #PSP SRefresh: Base record of Loyalty Promotion 7225 processed; result code 0.
 8:43:22 #PSP SRefresh: Processing details of Loyalty Promotion 7225
 8:43:27 #PSP SRefresh: 3 detail records processed; 0 errors.
 8:43:29 12/06/11
 8:43:29 #PSP SRefresh: Base record of Loyalty Promotion 7226 processed; result code 0.
 8:43:29 #PSP SRefresh: Processing details of Loyalty Promotion 7226
 8:43:29 #PSP SRefresh: ProcessCLOYUpdates(): data not found - [dbo].[CLOY_PROMO_ITEMS].PROMO_ID = 7226 AND [dbo].[CLOY_PROMO_ITEMS].ERR_CD = 0
 9:46:24 12/06/11
 9:46:24 #PSP SRefresh: Loyalty promotion on total [7225] processed.
 9:46:24 #PSP SRefresh: Base record of Loyalty Promotion 7225 processed; result code 0.
 9:46:24 #PSP SRefresh: Processing details of Loyalty Promotion 7225
 9:46:28 #PSP SRefresh: 3 detail records processed; 0 errors.
 9:46:30 12/06/11
 9:46:30 #PSP SRefresh: Base record of Loyalty Promotion 7226 processed; result code 0.
 9:46:30 #PSP SRefresh: Processing details of Loyalty Promotion 7226
 9:46:30 #PSP SRefresh: ProcessCLOYUpdates(): data not found - [dbo].[CLOY_PROMO_ITEMS].PROMO_ID = 7226 AND [dbo].[CLOY_PROMO_ITEMS].ERR_CD = 0
 9:47:29 12/06/11
 9:47:29 #PSP SRefresh: Loyalty promotion on total [7227] processed.
 9:47:29 #PSP SRefresh: Base record of Loyalty Promotion 7227 processed; result code 0.
 9:47:29 #PSP SRefresh: Processing details of Loyalty Promotion 7227
 9:47:32 #PSP SRefresh: 2 detail records processed; 0 errors.







------解决方案--------------------
加一个判断日期的
select * from #t where temp like '%CLOY_PROMO_ITEMS%' or ISDATE(temp)=1 
PROMO_ID = 7226 值的上一条就是日期