Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function does not work in DTS package

Status
Not open for further replies.

aruba

Programmer
Sep 5, 2003
47
I have created a function that passes 2 parameters to return one result. The function works properly in SQL however when I call it in a DTS package, I get the following error:
Procedure or function has too many arguments specified.

If I remove one of the parameters, it works fine, however does not accomplish the purpose.

Can anyone suggest any resolution to this? Thanks.
 
Please post you function as well as the statments in your SP or DTS package that is using the function.

Thanks

J. Kusch
 
Here is the SQL statement:
update wkctl.tidwotsk set system_code = wkctl.extract_usi(WR_TASK_TITLE,UNIT)
where system_code is null or system_code = ""

The function is:
CREATE function WKCTL.extract_usi(@strtitle varchar(60), @strUnit varchar(6) )
returns varchar(6)
as
BEGIN

declare @strsystem varchar(6)
declare @intchar int
declare @strID varchar(1)
declare @strgetID varchar(1)

set @strsystem = ''
set @intchar = 1
set @strID = ''


while @intchar < len(@strtitle) + 1
begin
if substring(@strtitle, @intchar, 1) in
('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
begin

set @strsystem = @strsystem + substring(@strtitle, @intchar, 1)

if len(@strsystem) > 4
begin

set @strgetID = wkctl.station_id(@strUnit)
SET @strID = CASE
WHEN @strgetID = 'N'THEN 'B'
WHEN @strgetID = 'C' THEN 'S'
ELSE
'B'
END

return (@strsystem + @strID)
end

end
else
begin
set @strsystem = ''
end

set @intchar = @intchar + 1

end

set @strsystem = ''
return @strsystem

END





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top