Hey all,
I am running into an issue trying to call a user defined function across servers. Then error I am getting is The multi-part identifier "myserver.database.schema.functionname" could not be bound.

This is the code I am trying to use:

Code:
				  declare @storeNo INT
				  declare @vendorID INT
				  declare @payAgreed BIT
				  select @sql = N'select @store = IST.Store_No, @vendor = IVS.Vendor_ID
								 FROM POHeader H
                                    inner join ' + @DBString + '[Store] IST on H.BusinessUnit = IST.BusinessUnit_ID
                                    inner join ' + @DBString + '[Vendor] IVS on IVS.Store_No = IST.Store_No'
				  exec sp_executesql @sql 
                            , N'@store INT OUTPUT,@vendor int OUTPUT'
                            ,  @store = @storeNO OUTPUT, @vendor = @vendorID OUTPUT

				  select @sql = N'SET @payAgreedCost = ' + @DBString + '[fn_IsPayByAgreedCostStoreVendor(@storeNo, @vendorID, getdate())]'
				  exec sp_executesql @sql 
                            , N'@payAgreedCost BIT OUTPUT'
                            , @payAgreedCost = @payAgreed OUTPUT
any ideas on how to work around this?

Thanks!