我想从Taskdescription选项卡中获取URL,并在其他列中使用名称URL获取它。现在我正在使用此代码
select
c.StreamName AS Category,
ProcessInstanceAppianID as jobId,
a.ProcessInstanceName,
a.ProcessInstanceTargetDate AS TargetDate,
a.ProcessInstanceDescription as TaskDescription,
b.Name as department,
SUBSTRING(ProcessInstanceName, NULLIF(PATINDEX('%[0-9][0-9][0-9][0-9][0-9]%',ProcessInstanceName),0),7) as code
from InternalUseOnly..ProcessInstance a
join InternalUseOnly..Departments b on
b.KeyDepartment = a.KeyDepartmentEntered
AND b.updoperation < 2
join InternalUseOnly..ProcessStream c on
c.KeyProcessStream = a.KeyProcessStream
and c.updoperation < 2
where ProcessInstanceCompleted is null
and a.KeyProcessStream in (330)
and a.updoperation <2
提前致谢
答案 0 :(得分:3)
如果您使用的是SQL Server,那么这将解决问题
SELECT substring(ProcessInstanceDescription , charindex('http://', ProcessInstanceDescription ), charindex('KeyInstr', ProcessInstanceDescription ) - charindex('http://', ProcessInstanceDescription ))
FROM InternalUseOnly..ProcessInstance;
让我们说今天心情很好,这是您需要的代码。该URL将位于第一列。
select
substring(a.ProcessInstanceDescription , charindex('http://', a.ProcessInstanceDescription ), charindex('KeyInstr', a.ProcessInstanceDescription ) - charindex('http://', a.ProcessInstanceDescription )),
c.StreamName AS Category,
ProcessInstanceAppianID as jobId,
a.ProcessInstanceName,
a.ProcessInstanceTargetDate AS TargetDate,
a.ProcessInstanceDescription as TaskDescription,
b.Name as department,
SUBSTRING(ProcessInstanceName, NULLIF(PATINDEX('%[0-9][0-9][0-9][0-9][0-9]%',ProcessInstanceName),0),7) as code
from InternalUseOnly..ProcessInstance a
join InternalUseOnly..Departments b on
b.KeyDepartment = a.KeyDepartmentEntered
AND b.updoperation < 2
join InternalUseOnly..ProcessStream c on
c.KeyProcessStream = a.KeyProcessStream
and c.updoperation < 2
where ProcessInstanceCompleted is null
and a.KeyProcessStream in (330)
and a.updoperation <2
<强>更新强>
关于Invalid length parameter passed to the LEFT or SUBSTRING function.
错误,这意味着您位于ProcessInstanceDescription
列中的某个位置,该行不符合我的SUBSTRING()
格式。
祝你好运,因为这是另一个问题,我不打算给你解决方案,首先是因为信息不足,你不合作,显然不愿意自己做一些努力。