我有这样的存储过程:
DECLARE @comando as varchar(5000)
set @comando = 'DTEXEC /FILE \"" /de "pass" /CHECKPOINTING OFF /REPORTING EW'
select @comando = @comando + ' /SET "\"\Package.Variables[' + Replace(str_NombreVariable,'User::','') + '].Value\"";'
+ str_ValorVariable + ''
from [Catalogo].[catVariablesEtl] where IdPaquete = 42
我收到这样的大件物品:
DTEXEC /FILE \"" /de "pass" /CHECKPOINTING OFF /REPORTING EW /SET "\"\Package.Variables[v_sTipoCarga].Value\"";M /SET "\"\Package.Variables[v_sUsuarioCarga].Value\"";0 /SET "\"\Package.Variables[v_sCadenaConexion].Value\"";"\"Data Source=0.0.0.0.0\DB;User ID=BB;Password=BBA;Initial Catalog=BS;Persist Security Info=True;Initial Catalog=BBS;Persist Security Info=True;\"" /SET "\"\Package.Variables[v_sCadenaConexionSAP].Value\"";"\"TYPE=A; ASHOST=0.0.0.0.0; SYSNR=70; CLIENT=720; LANG=ES; USER=BB; PASSWD=BB1;\"" /SET "\"\Package.Variables[v_sRutaArchivo].Value\"";"\"\\0.0.0.0\SIBISharedFolder\Source\CargaMaquinas\ /SET "\"\Package.Variables[v_IdBitacoraCarga].Value\"";0
倒数第二个值为Package.Variables[v_sRutaArchivo].Value
且str_ValorVariable
等于\\0.0.0.0\SIBISharedFolder\Source\CargaMaquinas\
,我想知道是否可以通过搜索此项来向此选择添加字符串:v_sRutaArchivo
in str_NombreVariable
当它发现添加到str_ValorVariable
值.csv
有可能实现吗?
答案 0 :(得分:0)
DECLARE @comando as varchar(5000)
set @comando = 'DTEXEC /FILE \"" /de "pass" /CHECKPOINTING OFF /REPORTING EW'
select @comando = @comando + ' /SET "\"\Package.Variables[' + Replace(str_NombreVariable,'User::','') + '].Value\"";'
+ str_ValorVariable + CASE WHEN str_NombreVariable like '%v_sRutaArchivo%' THEN '.csv' ELSE '' END + ''
from [Catalogo].[catVariablesEtl] where IdPaquete = 42