简体   繁体   English

将DB2 SQL表达式转换为Sql Server

[英]Convert DB2 SQL expression to Sql Server

Can anyone tell me the meaning of this query below? 任何人都可以在下面告诉我该查询的含义吗? Also I'm trying to ocnvert this query into its SQL Server equivalent. 另外,我正在尝试将此查询转换为与其SQL Server等效的查询。 Any help if greatly appreciated. 任何帮助,如果不胜感激。 Not familiar with Locate function or what the use of '||' 不熟悉定位功能或“ ||”的用法 means in DB2 DBstring is a column in the DB/ I'm on SQL Server 2012 表示DB2中的DBstring是DB中的一列/我在SQL Server 2012中

 SUBSTR(DBstring, LOC('5'||CHR(9)||'CH', DBstring) + 2, 2) = 'CH'

I know SUBSTR is SUBSTRING in SQL Server. 我知道SUBSTR在SQL Server中是SUBSTRING。 I think SQL SERVER has a LOCATE function. 我认为SQL SERVER具有LOCATE函数。 Specifically I'm not sure what this part of the query is doing ' LOC('5'||CHR(9)||'CH', DBstring) + 2' 具体来说,我不确定查询的这部分在做什么'LOC('5'|| CHR(9)||'CH',DBstring)+ 2'

I think loc is equivalent to locate . 我认为loc等于locate The expression in SQL Server would be: SQL Server中的表达式为:

substr(dbstring, charindex('5'+CHAR(9)+'CH', DBstring) + 2, 2) = 'CH'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM