kiran

kiran

  • NA
  • 285
  • 4.9k

SQL Server Function returns an error.

Aug 11 2014 2:37 AM
I created one function to check whether the id exists or not. If it is exists then it returns 1 otherwise it returns 0 but i got an error like this 
 
RETURN statements in scalar valued functions must include an argument. 
 
My function is
 
create function [dbo].[CheckStudentId](@ID varchar(10))
returns varchar
as
begin
return
if exists (select id from Tablename where id=@ID)
print 1
else
print 0
end
 
Thanks in advance 
 

Answers (1)