snytax or logic problem?

I have attached the code and the question.
func.txt
1jawsAsked:
Who is Participating?
 
Scott PletcherConnect With a Mentor Senior DBACommented:
declare @src varchar(10),
        @trg varchar(10)
       
select @src = dbo.getCode (@srcCode),
       @trg = dbo.getCode (@trgCode)

      update tblFind
      set Subject= dbo.gofind(@Subject,@src,@trg),
          Body = dbo.gofind(@Body,@src,@trg)
      where id = @id      
0
 
skrgaCommented:
You shoul use
select dbo.getCode (@srcCode,@trgCode)  

Open in new window

.. in same call ..
0
 
1jawsAuthor Commented:
I am trying to get value from getCode function and use that value on gofind function as a parameters set to @src, and @trg .. so that doesnt work... when I say on this line select dbo.getCode (@srcCode)  as src ,  saying as src doesnt really help me at all.... I need to modify that code that, it will give me a value from getCode function as a @src and as a @trg
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
1jawsAuthor Commented:
how about like that? but that gives me snytax error of the  ')' for the first line...
update tblFind
	set Subject= dbo.gofind(@Subject,dbo.getCode (@srcCode), @src),dbo.getCode (@trgCode), @trg)),
	    Body = dbo.gofind(@Body,dbo.getCode (@srcCode), @src),dbo.getCode (@trgCode), @trg))
	where id = @id

Open in new window

0
 
Scott PletcherSenior DBACommented:
You can't use a function call as a parameter to a function.

You would have to use a subquery to do the first function call, then use the results of that in an outer query to the other function call.
0
 
1jawsAuthor Commented:
how about like that?
alter PROCEDURE [dbo].[spMysp] 
   @id int,
   @orSubject nvarchar(255),
   @orBody nvarchar(max),
   @srcCode char(2),
   @trgCode char(2)
   
as
begin
 

declare @src varchar(10),
        @trg varchar(10)
        
 select @src = wlCode 			 				
		from tblcode
		where Code = @srcCode		
		
		select @trg = wlCode 			 				
		from tblcode
		where Code = @trgCode

	update tblFind
	set Subject= dbo.gofind(@Subject,@src,@trg),
	    Body = dbo.gofind(@Body,@src,@trg)
	where id = @id	
end

Open in new window

0
 
1jawsAuthor Commented:
thank you very much!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.