sql-server - SQL Server 子字符串(子字符串())
问题描述
使用两次 substing() 给我一个错误。有没有办法得到相同的结果?
select [Identifiant] as [ID payment],
[Etat de la dépense] as [Status payment],
[Code bénéficiaire] as [Recipient code of payment],
substring(substring([Information projet], 83, 100) as [sting], 1, PATINDEX('%Code Branche%', [string])-1) as [Recipient of payment]
into [DB].[dbo].[Check_Result]
from [DB].[dbo].Expenses_SAP$
解决方案
您不能为内部子字符串设置别名。目前尚不清楚您将尝试通过这样做来实现什么,所以我不能真正建议正确的方法来做任何事情。
拿出来as [sting]
,至少你应该有有效的语法:
substring(substring([Information projet], 83, 100), 1, PATINDEX('%Code Branche%', [string])-1) as [Recipient of payment]
推荐阅读
- c# - 以一种奇怪的方式将两个列表连接在一起
- python - Flask 应用程序仅在计算机重新启动后才加载 css 更改
- django - 如何在django中实现依赖模型字段的思想?
- swift - SWIFT UI LOTTIE:线程 1:EXC_BAD_INSTRUCTION(代码=EXC_I386_INVOP,子代码=0x0)
- ios - 无法再在 Xcode 上对我的项目添加或删除更改
- firebase - 我在云 Firestore 交易中遇到异常
- c - 访问浮点数据位 - 无法找到解决方案
- performance - 在 Snowflake 中,调整现有仓库的大小是否有助于提高正在运行的查询的性能?
- css - 在孩子上课时获取最后一个孩子
- c# - 如何简化 Xamarin Forms 中字体和背景颜色的设置?