Invalid length parameter with value of -4 passed to the substringfunction. in ASE 15 server -
06-04-2011
, 05:29 AM
Dear All,
Below query returning error. but, same query executes successfully in
other 2 servers with out error.
Adaptive Server Enterprise/15.0.3/EBF 17775 ESD#4/P/RS6000/AIX 5.3/
ase1503/2768/64-bit/FBO/Thu Aug 26 07:36:52 2010
What is reason?
QUERY:
---------------------
declare @tbl_name varchar(30)
select @tbl_name = 'expoparameters'
SELECT left(c.name, 20),
len(ltrim(rtrim(c.name))) - len('_module_id'),
left(ltrim(rtrim(c.name)), (len(ltrim(rtrim(c.name))) -
len('_module_id'))),
left(@tbl_name, len(left(c.name, (len(ltrim(rtrim(c.name))) -
len('_module_id')))))
FROM syscolumns c, sysobjects o
WHERE o.type = 'U'
AND o.name = @tbl_name
AND o.id = c.id
AND right(c.name,10) = '_module_id'
AND exists(SELECT 1 from modules m WHERE m.module_id = left(c.name,
(len(ltrim(rtrim(c.name))) - len('_module_id'))))
/* The following two lines are giving error, which are selected above
*/
AND left(c.name, (len(ltrim(rtrim(c.name))) - len('_module_id'))) =
left(@tbl_name, len(left(c.name, (len(ltrim(rtrim(c.name))) -
len('_module_id')))))
================================================== =======================
one server RESULT:
(1 row affected)
Msg 536, Level 16, State 4:
Server 'CBSPRCLI', Line 3:
Invalid length parameter with value of -4 passed to the substring
function.
================================================== =======================
Other server Results:
(1 row affected)
-------------------- -----------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------
expo_module_id 4
expo
expo
(1 row affected)
================================================== ======================= |