SQL中的函数与Oracle中的DECODE一样有效吗? 谢谢, N
解决方案使用案例 - David Portas SQL Server MVP -
当Assignment_Type ='''C''那时'选择案例'''''''''''''''''''''' 'Donot Know'' 来自分配 当我尝试使用CASE WHEN时,它给了我错误[Microsoft] [ODBC SQL Server Driver] [SQL Server]关键字''FROM'附近的语法不正确。我做了什么 错了? 谢谢 " David Portas" < RE **************************** @ acm>在消息中写道 news:24 ******************** @ giganews ... 使用案例 - David Portas SQL Server MVP -
>我做了什么
错了?你没有先读完语法!我的回复是作为你应该查找的东西的 指示。如果你偶尔提到它,你会发现在线书籍是一个很好的资源:-) 选择案例当Assignment_Type ='''C''那么''''''''''''''''''''''''''$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $选择案例Assignment_Type当''C''那么'''''''''''''''''''''''''''''''''$ $ $ $ $ $ $ $ b b b b b b b b b /> David Portas SQL Server MVP -
What is the function in SQL that works like DECODE in Oracle?" Thanks, N
解决方案 Use CASE -- David Portas SQL Server MVP --SELECT CASE WHEN Assignment_Type = ''C'' THEN ''Com'' ELSE ''Donot Know'' FROM ASSIGNMENT When I try to use CASE WHEN, it gave me error [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword ''FROM''. What did I do wrong? Thanks "David Portas" <RE****************************@acm> wrote in message news:24********************@giganews... Use CASE -- David Portas SQL Server MVP --> What did I do wrong?You didn''t read-up on the syntax first! My reply was intended as an indication of something you should look up. You''ll find Books Online is a great resource if you refer to it occassionally :-) SELECT CASE WHEN Assignment_Type = ''C'' THEN ''Com'' ELSE ''Do not know'' END FROM ASSIGNMENT or SELECT CASE Assignment_Type WHEN ''C'' THEN ''Com'' ELSE ''Do not know'' END FROM ASSIGNMENT -- David Portas SQL Server MVP --
更多推荐
SQL Server中的DECODE?“
发布评论