Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Invalid length parameter passed

Author  Topic 

Dilan13
Starting Member

6 Posts

Posted - 2011-06-17 : 11:15:24
I am getting the following error message

"Invalid length parameter passed to the SUBSTRING FUNCTION" when running the following query.

If I remove the where caluse then it works. dbo.view is another view and is working fine. Column] value contain numbers

ANy idea on what is causing the problem? This query used to work before

select [Years] as 'Years', [Scenario] as 'Scenario', 'M1' AS 'Period','Amount' as 'ValueType', [Currency] as 'Currency', [Source] as 'Source', [Version] as 'version', [Building] as 'building',

[CostCenter] as 'CostCenter', [Account] as 'account', [Value]/12 as 'Amount'

from [dbo].[vie]



where [Value] <>0

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-06-17 : 11:25:08
is vie a view?

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Dilan13
Starting Member

6 Posts

Posted - 2011-06-17 : 11:30:26
yes, it's a view
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-06-17 : 11:42:25
Have a look at the view - there is probably a substring, left or right statement or a udf in it that is causing problems.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -