惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Latest news
Latest news
T
The Exploit Database - CXSecurity.com
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
L
Lohrmann on Cybersecurity
aimingoo的专栏
aimingoo的专栏
B
Blog
T
Threat Research - Cisco Blogs
罗磊的独立博客
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Proofpoint News Feed
P
Palo Alto Networks Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
宝玉的分享
宝玉的分享
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
T
Tor Project blog
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
酷 壳 – CoolShell
酷 壳 – CoolShell
Recorded Future
Recorded Future
D
DataBreaches.Net
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家
B
Blog RSS Feed
Scott Helme
Scott Helme
P
Proofpoint News Feed
V
Vulnerabilities – Threatpost
A
Arctic Wolf
Help Net Security
Help Net Security
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Vercel News
Vercel News
AWS News Blog
AWS News Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Schneier on Security
Hacker News: Ask HN
Hacker News: Ask HN
N
Netflix TechBlog - Medium
L
LangChain Blog
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
M
MIT News - Artificial intelligence
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
W
WeLiveSecurity

博客园 - 大天使泰瑞尔

通过反射机制控制前台的数据项的显示和隐藏 由partition看窗口函数 IE 6下CSS浮动样式的问题 ASP.NET 2.0 中控件的简单异步回调 新手基础知识专用 今天终于学会了从客户端调用Web Service 学会了ASP.NET 2.0中的数据批量更新 - 大天使泰瑞尔 - 博客园 数据结构学习(6):队列 数据结构学习(5):链表 数据结构学习(4):栈 数据结构学习(3):堆化优先队列 数据结构学习(2):汉诺塔问题 数据结构学习(1):搜索二叉树 冒泡算法的三种JavaScript表示 YUI学习(1):ToolTip的用法 XML学习失误系列(2):分清节点性质,使用nodeValue JavaScript&DHTML特效学习(1):MSN提示框 YUI的Drap&Drop对IE7不支持 Gmail邮箱可以直接注册了
转载一篇拼SQL字符串的语句
大天使泰瑞尔 · 2008-07-08 · via 博客园 - 大天使泰瑞尔

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
goALTER    PROCEDURE [dbo].[T_Consultation_Select] 
    
@ConsultationStyleID TINYINT,
    
@AnswerUserID VARCHAR(30),
    
@IncomeCallBeginTime [DATETIME],
    
@IncomeCallEndTime [DATETIME]
    
AS
    
BEGIN
        
DECLARE @whereStr VARCHAR(8000),
        
@count INT
        
SET @count=0
        
SET @whereStr=''
        
IF  @ConsultationStyleID IS NOT NULL
          
BEGIN
               
IF(@count>0)
                
BEGIN
                 
SELECT @whereStr=@whereStr+'    AND T_Consultation.ConsultationStyleID  ='+Convert(Varchar(10),@ConsultationStyleID)
             
END
        
ELSE
             
BEGIN
                 
SELECT @whereStr=@whereStr+'  T_Consultation.ConsultationStyleID ='+Convert(Varchar(10),@ConsultationStyleID)
               
END
          
SET  @count=@count +1
           
END
           
IF  @AnswerUserID IS NOT NULL
          
BEGIN
               
IF(@count>0)
                
BEGIN
                 
SELECT @whereStr=@whereStr+'    AND T_Consultation.AnswerUserID  ='''+Convert(Varchar(10),@AnswerUserID)''
             
END
        
ELSE
             
BEGIN
                 
SELECT @whereStr=@whereStr+'  T_Consultation.AnswerUserID ='''+Convert(Varchar(10),@AnswerUserID)''
               
END
          
SET  @count=@count +1
           
END
            
IF @IncomeCallBeginTime IS NOT NULL
                
BEGIN
                    
IF(@count>0)
                        
BEGIN
                             
SELECT @whereStr=@whereStr+' AND  T_Consultation.CreateTime >=''+ CONVERT(VARCHAR(10),@IncomeCallBeginTime)'''
                        
END
            
ELSE
                    
BEGIN
                       
SELECT @whereStr=@whereStr+'  T_Consultation.CreateTime >='' + CONVERT(VARCHAR(10),@IncomeCallBeginTime)'''
                    
END        
                
END
             
IF @IncomeCallEndTime IS NOT NULL
                
BEGIN
                    
IF(@count>0)
                        
BEGIN                                                                                                            
                             
SELECT @whereStr=@whereStr+' AND  T_Consultation.CreateTime <='' + CONVERT(VARCHAR(10),@IncomeCallEndTime)'''
                        
END
            
ELSE
                    
BEGIN
                       
SELECT @whereStr=@whereStr+'  T_Consultation.CreateTime <='' + CONVERT(VARCHAR(10),@IncomeCallEndTime)'''
                    
END        
                
END
           
IF(@count>0)
            
SELECT @whereStr='SELECT [CreateTime]
  FROM T_Consultation WHERE T_Consultation.FollowUpMark=
'+'1'+'  And ' + @whereStr
   
ELSE
   
SELECT @whereStr='SELECT ConsultationID,(SELECT ParaName FROM T_SysPara WHERE GroupID=14 AND ParaID=T_Consultation.ConsultationStyleID)AS ConsultationStyleID,
            [ConsultationContent],[ConsultationResults],(SELECT ParaName FROM T_SysPara WHERE GroupID=16 AND ParaID=T_Consultation.HaveOrderingIntention)AS HaveOrderingIntention,[OrderingIntentionContent],
  [CustomerID],[AnswerUserID],[CreateTime]
  FROM T_Consultation where  T_Consultation.FollowUpMark=
'+'1' 
END
select  (@whereStr)