>USE [SMS] >GO >SET ANSI_NULLS ON >GO >SET QUOTED_IDENTIFIER ON >GO > >-- ============================================= >-- Author: Jeff Hibbs >-- Create date: March 23, 2010 >-- Description: Returns Current Current Primary Insurance >-- ============================================= >CREATE FUNCTION [dbo].[GetPrimaryInsurance] > >(-- Student Id to be passed into function, as Student > -- can only have one primary at any given time. > @tStudentID Char(36), > @tDate datetime >) > >RETURNS varchar(50) >AS > >BEGIN > > DECLARE @tcCompany_Name varchar(50) > > -- Get Current Term > SET @tcCompany_Name = (select cCompany_Name from student_insurance where cStudent_cId = @tStudentID AND > deffective <= @tDate and (dtermination > @tDate or dtermination is NULL) and ctype = 'Primary') > > RETURN @tcCompany_Name > >END >What is the exact problem here? What does it return?