【发布时间】:2017-06-12 20:07:57
【问题描述】:
我正在运行优势数据库 10。
我的一个字段数据库具有“客户名称”,它存储为“姓氏,名字”。我希望能够从该字段中提取名字。我认为这可行,但没有骰子:
SELECT [Customer Name]
,LEFT([Customer Name], CHARINDEX(',', [Customer Name]) - 1) AS [Surname]
,REPLACE(SUBSTRING([Customer Name], CHARINDEX(',', [Customer Name]), LEN([FullName])), ',', '') AS [FirstName]
FROM orders
我没有收到任何结果。这是错误消息:
poQuery: Error 7200: AQE Error: State = S0000; NativeError = 2158; [iAnywhere Solutions][Advantage SQL Engine]Scalar function not found: charindex -- Location of error in the SQL statement is: 57 (line: 2 column: 32)
基本上我需要 |客户名称 | 多伊,约翰
变成: |名字|姓氏 | 约翰 |能源部
【问题讨论】:
-
欢迎来到 StackOverflow!如果您想获得任何帮助,请阅读并关注How to ask a good SQL question,并且不要让您的问题被否决或关闭
-
好的,那么“没有骰子”是什么意思?你看到的实际行为是什么?您是否收到错误消息或意外结果?请澄清。
-
对不起!我的意思是我没有收到任何结果。这是错误消息:poQuery:错误 7200:AQE 错误:状态 = S0000;本机错误 = 2158; [iAnywhere 解决方案][Advantage SQL Engine]Scalar function not found: charindex -- SQL 语句中的错误位置是:57 (line: 2 column: 32)
标签: sql advantage-database-server