I'm trying to use a function to strip anything but numeric characters from a column in a select statement. I'm getting the error that the multi-part identifier could not be bound on the line calling the function.
Here is my function
create function scrubNetWt (@input varchar(50)) returns varchar(50) AS Begin Return Left( SubString(@input, PatIndex('%[0-9.-]%', @input), 8000), PatIndex('%[^0-9.-]%', SubString(@input, PatIndex('%[0-9.-]%', @input), 8000) + 'X')-1) End Here is my select statement where I'm trying to use the function
USE [TFP] GO SELECT [pick_ticket_id] ,[pick_ticket_no] ,[proform_net_wt] ,[proform_cr_no] ,[TFP].[dbo].[scrubNetWt(proform_net_wt)] AS net_wt FROM [TFP].[dbo].[pick_ticket_ud]
[TFP].[dbo].[scrubNetWt](proform_net_wt).