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!

Problem converting to bigint in a function

Status
Not open for further replies.

aruba

Programmer
Sep 5, 2003
47
When I run the following SQL statement I get an error saying "Invalid column name(E99000).

select wkctl.parentwo_convertToPP(E99000)

Here is the code for the function:
create function wkctl.parentwo_convertToPP_T(@parentwo varchar(9))
returns bigint
as
begin

declare @numparentwo bigint

SET @numparentwo = CASE

WHEN @parentwo like '%A%' THEN '010'
WHEN @parentwo like '%B%' THEN '011'
WHEN @parentwo like '%C%' THEN '012'
WHEN @parentwo like '%D%' THEN '013'
WHEN @parentwo like '%E%' THEN '014'
WHEN @parentwo like '%F%' THEN '015'
WHEN @parentwo like '%G%' THEN '016'
WHEN @parentwo like '%H%' THEN '017'
WHEN @parentwo like '%J%' THEN '018'
WHEN @parentwo like '%K%' THEN '019'
END
+ substring(@parentwo,2,5)
set @numparentwo = convert(bigint,@numparentwo)

return (@numparentwo)

End

Can anyone suggest what is wrong? Any help would be appreciated.
 
What version of SQL Server are you running. The datatype BigInt is new to SQL Server 2000 and NOT 7.

Thanks

J. Kusch
 
We use SQL Server 2000. The code works fine when I test it by assigning a number to the variable, however it doesn't when I change it to a function with parameters.
 
Many thanks! Problem solved!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top