Reporting services 传递到左侧的长度参数无效或子字符串错误
当我试图在查询中使用子字符串和charindex时,我遇到了一个错误Reporting services 传递到左侧的长度参数无效或子字符串错误,reporting-services,ssrs-2012,Reporting Services,Ssrs 2012,当我试图在查询中使用子字符串和charindex时,我遇到了一个错误 Concat('https://api.giscloud.com/1/layers/2985288/features/',f.fid,'/mosque_status_photos /',substring(f.mosque_status_photos,1,CharIndex(',',f.mosque_status_photos,0)-1),'?api_key=a2cdb99935fec159f9557b24fae90f00')
Concat('https://api.giscloud.com/1/layers/2985288/features/',f.fid,'/mosque_status_photos /',substring(f.mosque_status_photos,1,CharIndex(',',f.mosque_status_photos,0)-1),'?api_key=a2cdb99935fec159f9557b24fae90f00')
我还尝试了案例功能bt仍然得到eror
case when isnull(f.mosque_status_photos,'0') is null
then '0' else
Concat('https://api.giscloud.com/1/layers/2985288/features/',f.fid,'/mosque_status_photos /',substring(f.mosque_status_photos,1,CharIndex(',',f.mosque_status_photos,0)- 1),'?api_key=a2cdb99935fec159f9557b24fae90f00') end
我也使用了isnull函数,但仍然会出错
Concat('https://api.giscloud.com/1/layers/2985288/features/',f.fid,'/mosque_status_photos/',substring(isnull(f.mosque_status_photos,'0'),1,CharIndex(',',isnull(f.mosque_status_photos,'0'),0)-1),'?api_key=a2cdb99935fec159f9557b24fae90f00')
您的case语句在开始时是错误的,它将所有空值转换为“0”字符,然后检查结果是否为空,这将永远不会是这种情况 可能是您想要的(假设您在
清真寺\状态\照片列中查找逗号)
CASE WHEN f.mosque_status_photos not like ','
OR CharIndex(',',f.mosque_status_photos,0) <=1
OR LEN(LTRIM(RTRIM(mosque_status_photos))) = 0
THEN '0'
ELSE [original code for valid entries here]
END
f.mosque_状态_照片不象“,”时的情况
或CharIndex(“,”,f.mosque_状态_照片,0)