I have created a function to check that the provided number is either even or odd?
But when I run the function it is giving below error.
Msg 245, Level 16, State 1, Line 101
Conversion failed when converting the varchar value ' No is Odd' to data type int."
I know error occurs because of different data types. Please assist.
Used below code.
Create function fn_tocheckodd_even
Declare @Num int
Set @Num= (Select
then 'No is Even'
' No is Odd' end as Q1)
But if use number 1 instead of 'No is Even ' and Number 2 instead of 'No is odd', then the function works.