Showing posts with label scalar. Show all posts
Showing posts with label scalar. Show all posts

Wednesday, March 7, 2012

Function Compiling Error 2005(2153)

Hello!

I have scalar function which calls from stored procedure. When SP recompiling (before start) in profiler I see Exception "Error: 536, Severity: 16, State: 5" - Invalid length parameter passed to the SUBSTRING function. at next line of function (original text changed for easy sample) :

if @.p1=4 set @.s1=substring(@.ipstr,1,@.p1-1)

but at same line like:

if @.p1=4 set @.s1=substring(@.ipstr,1,3)

works good.

Somebody can explain such?

I think you should proivide full repro with variables declaration and initialization.

Don't forget to mention MSSQL version you run this script on.

Function

What are the diffferences between a scalar Function and a table function?http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

Get it today :)|||It's Free!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!

Wow!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!

:)|||It's Free!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!But worth much, much more!

-PatP|||Indeed. I read it more then all my other books. lol|||And it contains answers to questions i havent even thought up yet :)