Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 If condition with UDF

Author  Topic 

danasegarane76
Posting Yak Master

242 Posts

Posted - 2015-03-06 : 02:37:29
Hi All,
I have UDF function that returns 0,1 and I wish to use this function as in a PROC


If fn_test(10) Then
SET @Name = 'TEST'


But it says

quote:
An expression of non-boolean type specified in a context where a condition is expected, near 'SET'.


What I am missing here?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2015-03-06 : 03:00:41
IF fn_test(10) = "WHAT? "
set @name = 'test';



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

danasegarane76
Posting Yak Master

242 Posts

Posted - 2015-03-06 : 03:13:30
Thanks that worked
Go to Top of Page
   

- Advertisement -