免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2159 | 回复: 6
打印 上一主题 下一主题

SQL 语句问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-03-03 10:11 |只看该作者 |倒序浏览
select convert(char(30), co.name) 'ID',
       (case
         when co.status &128 = 128 then
          'Act/Del'         
         when co.status &64 = 64 then
          'Pend/Act'        
         when co.status &32 = 32 then
          'active'
        end) '02.10.05.01',
       (case
         when co.status &1 = 1 then
          'Default'         
         when co.status &4 = 4 then
          'Log Only'        
         when co.status &2 = 2 then
          'Mixed'
        end) '02.10.05.02',
       str(round(convert(numeric(20, 9), co.value) / 1024, 2), 10, 2) '02.10.05.03',
       str(round(convert(numeric(20, 9), cu.value) / 1024, 2), 10, 2) '02.10.05.04'
  from master.dbo.sysconfigures co, master.dbo.syscurconfigs cu
where parent = 19
   and co.config = cu.config
   and co.name = cu.comment
   and co.config = 19


   Server Message:  Number  102, Severity  15
   Line 3:
   Incorrect syntax near 'when'.


版本小于12.1.5,只知道12.1.5以下不支持嵌套查询,难道也不支持CASE……WHEN……?

如果不知道,如果实现上述功能?

论坛徽章:
0
2 [报告]
发表于 2008-03-04 08:36 |只看该作者
各位大侠帮忙啊,谢谢

论坛徽章:
0
3 [报告]
发表于 2008-03-04 14:48 |只看该作者
补充一下,快来帮忙啊

环境是12.5.1上好用
现在的是11.0不好用,网上说11.5以下都不支持,难道Sybase低版本的就不至此这种语法,就没有实现的方法吗?

[ 本帖最后由 gengpengfeiX 于 2008-3-4 16:00 编辑 ]

论坛徽章:
1
2017金鸡报晓
日期:2017-01-10 15:19:56
4 [报告]
发表于 2008-03-04 15:07 |只看该作者
12.0.0.6可以呀,以前的版本手上没有了。

论坛徽章:
0
5 [报告]
发表于 2008-03-04 17:12 |只看该作者
有没有用过低版本的,快来说一说 ,Sybase怎么会没有这个相识的语法呢

论坛徽章:
1
2017金鸡报晓
日期:2017-01-10 15:19:56
6 [报告]
发表于 2008-03-04 20:39 |只看该作者
在低的版本上不支持很正常呀。

论坛徽章:
0
7 [报告]
发表于 2008-03-05 13:08 |只看该作者
那要是Sybase遇到下面这样的逻辑,怎么处理
              IF………………
              else if………………
              else if………………
              else………………
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP