0
down vote
favorite
I am having a bit of a problem in SS 2008. I have a front-end form that sends item type and quantity. Then SS would produce IDS that equal the number of the given quantity for the given items. So the input is like:
Laptop 1000 UPS 10
The above wouldnt work cos laptops are 1000. But the following works:
laptop 300 ups 350 desktop 300 calculator 300 ... the sum can go beyound 1000 totally as long as the individual items are below 350
Portion of the Code I have is:
It works as expected. It returns the needed IDs in CSV. But if quantity of a single type is more than 350, it stucks and returns nothing. The sum of single types can be greater than 1000 even and its result is as expected.
Is it a timeout issue? I cant understand whats happening at all since the total quantity can be higher and it works but fails if a single
down vote
favorite
I am having a bit of a problem in SS 2008. I have a front-end form that sends item type and quantity. Then SS would produce IDS that equal the number of the given quantity for the given items. So the input is like:
Laptop 1000 UPS 10
The above wouldnt work cos laptops are 1000. But the following works:
laptop 300 ups 350 desktop 300 calculator 300 ... the sum can go beyound 1000 totally as long as the individual items are below 350
Portion of the Code I have is:
Code:
DECLARE @ids varchar(max)='' DECLARE @currentid varchar(15) DECLARE @begin int=0 DECLARE @intgenwhat smallint -- GENERATE A NUMBER OR A LETTER? DECLARE @currentidlength smallint DECLARE @ownercode varchar(3)='ABC' BEGIN SET while @begin<@p1 BEGIN SET @currentid='' set @currentidlength=LEN(@currentid + @callercode) while @currentidlength<15 BEGIN SET @intgenwhat=FLOOR(2 * rand()) if @intgenwhat=0 SET @currentid= @currentid + cast(char(FLOOR(10 * rand()) + 48 ) as varchar) else SET @currentid= @currentid + cast(char(FLOOR(10 * rand()) + 65) as varchar) SET @currentidlength=@currentidlength + 1 END SET @ids=@ids + @ownercode + @callercode + @currentid + ',' SET @begin=@begin + 1 END --remove last , SET @ids=dbo.DSSMSFN_strRemoveCharacters(@ids,1,len(@ids)-1) END SELECT @companyids= @ids
Is it a timeout issue? I cant understand whats happening at all since the total quantity can be higher and it works but fails if a single
Comment