| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2155 人关注过本帖
标题:sql中添加参数方法
只看楼主 加入收藏
tianbian210
Rank: 1
等 级:新手上路
帖 子:46
专家分:1
注 册:2008-12-25
结帖率:87.5%
收藏
 问题点数:0 回复次数:2 
sql中添加参数方法
使用reporting service开发报表,
mysql数据源时问题。
需要在sql中添加几个参数,请大神协助:
select p.name as projectname,
       b.id,
       g.name categoryname,
       u.realname,
       b.summary,
       t.description,
       c.depart,
       c.owner,
       c.descrip,
       (case b.status
         when '10' then
          '新建'
         when '40' then
          '已确认'
         when '50' then
          '已分派'
         when '80' then
          '已解决'
         when '85' then
          '已验收'
         when '90' then
          '已关闭'
         else
          '其他'
       end) as status,
       FROM_UNIXTIME(b.date_submitted) as starttime,
       FROM_UNIXTIME(b.last_updated) as endtime
  from mantis_bug_table b,
       mantis_bug_text_table t,
       mantis_project_table p,
       mantis_category_table g,
       mantis_user_table u,
       (select a1.bug_id, a1.depart, a2.owner, a3.descrip
          from (select bug_id, value as depart
                  from mantis_custom_field_string_table
                 where field_id = '1') a1
          LEFT JOIN (select bug_id, value as owner
                      from mantis_custom_field_string_table
                     where field_id = '4') a2
            on a2.bug_id = a1.bug_id
          LEFT JOIN (select bug_id, value as descrip
                      from mantis_custom_field_string_table
                     where field_id = '7') a3
            on a3.bug_id = a2.bug_id) c
 where b.bug_text_id = t.id
   and b.project_id = p.id
   and b.id = c.bug_id
   and b.category_id = g.id
   and b.reporter_id = u.id
AND p.name like @proname || '%'
AND b.status  like @status || '%'


试过了@ + 参数名;$ +参数名。都没用。
哪位知道的帮忙看下。
搜索更多相关主题的帖子: sql reporting service 数据源 
2013-03-08 17:15
亲丶520
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2013-4-4
收藏
得分:0 
使用表了没
2013-05-17 22:35
java小蚂蚁
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:上海
等 级:贵宾
威 望:18
帖 子:558
专家分:2186
注 册:2013-7-2
收藏
得分:0 
直接加不行吗?一定呀加@这些?。或者你流个?在哪里,然后在其他地方不上。用占位符?来搞定,看行不

学海无涯#¥%……&*(
2013-08-10 23:46
快速回复:sql中添加参数方法
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026158 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved