我有这样的 SSIS 变量表达式,
@[System::PackageName]+","+
@[System::SourceName]+","+
(DT_STR,15,1252) @[System::ErrorCode]+","+
@[System::ErrorDescription]+","+
(RIGHT((DT_WSTR,4)
DATEPART("yyyy",GetDate()),4)+"/"+
RIGHT("0"+(DT_WSTR , 2)
DATEPART("mm", GetDate()),2)+"/"+
RIGHT("0"+(DT_WSTR,2)
DATEPART("dd",GetDate()),2)+"_"+
RIGHT("0"+(DT_WSTR,2)
DATEPART("HH",GetDate()),2)+":"+
RIGHT("0"+(DT_WSTR,2)
DATEPART("MM",GetDate()),2)+":"+
RIGHT("0"+(DT_WSTR,2)
DATEPART("SS",GetDate()),2))+","+
@[System::MachineName]
现在我想从中获取一些@[System::ErrorDescription]
位于之前的字符串,这是值at
的示例@[System::ErrorDescription]
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\blablablabl\yes.txt'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver)
at System.Threading.CompressedStack.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state)
我所做的是在我的变量表达式上编写子字符串代码:
SUBSTRING(@[System::ErrorDescription], 1, FINDSTRING(@[System::ErrorDescription], "at", 1)-1)+","+
但它总是给我一个错误,那个子字符串值不能为负,我的代码有什么问题?