Unless you create an Extended Stored Procedure to create dynamic sql thru and submit the value as a varchar(39) then you cannot. The requirement to deal with an undefined datatype that could be altered dynamically means you would have to build dynamic SQL, but as you cannot use EXECUTE to build and get your value back you would have to use sp_executesql, but Stored Procedures are not allowed inside Functions in 2000 but Extended SPs are, so to accomplish you would have to build an XP that does the job.