You are here: Re: INVALID LENGTH PARAMETER PASSED.... « MsSQL Server « IT news, forums, messages
Re: INVALID LENGTH PARAMETER PASSED....

Posted by rshivaraman on 06/04/07 17:11

On Jun 4, 12:43 pm, ansonee <anso...@yahoo.com> wrote:
> I have the follwoing stored procedure:
>
> ALTER procedure [dbo].[up_GetExecutionContext](
> @ExecutionGUID int = null
> ) as
> begin
> set nocount on
>
> declare @s varchar(500)
> declare @i int
>
> set @s = ''
> select @s = @s + EventType + ',' -- Dynamically build the list of
> events
> from(
> select distinct top 100 percent [event] as EventType
> from dbo.PackageStep
> where (@ExecutionGUID is null or PackageStep.packagerunid =
> @ExecutionGUID)
> order by 1
> ) as x
>
> set @i = len(@s)
> select case @i
> when 500 then left(@s, @i - 3) + '...' -- If string is too long then
> terminate with '...'
> else left(@s, @i - 1) -- else just remove the final comma
> end as 'Context'
>
> set nocount off
> end --procedure
> GO
>
> When I run this and pass in a value of NULL, things work fine. When I
> pass in an actual value (i.e. 15198), I get the following message:
>
> Invalid length parameter passed to the SUBSTRING function.
>
> There is no SUBSTRING being used anywhere in the query and the
> datatypes look okay to me.
>
> Any suggestions would be greatly appreciated.
>
> Thanks!!

increase the value of @s from 500 to 5000 maybe and test it ?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация