Declare @FileNumber int
Set @FileNumber = cast (SubString(@fileName, CharIndex('Stats', @fileName) + 6, charindex('.',@fileName) - (CharIndex('Stats', @fileName) + 6)) as int)
我正在''
传递@fileName
并收到此错误。这是在SQL Server 2016中
答案 0 :(得分:2)
因为......
select SubString('', 6 , - 6)
回归......
Msg 536, Level 16, State 1, Line 7
Invalid length parameter passed to the substring function.
https://docs.microsoft.com/en-us/sql/t-sql/functions/substring-transact-sql