When I create a tSQL function that I pass 2 variables to and only returns 1 I have issues calling the function. I look for the function and it doesn't show up under the scalar or table functions. When I try to "create" the function again it says that it already exists. I'm getting a "Cannot find either column "dbo" or the user-defined function or aggregate "dbo.TAFindTypeReturnCreateDate", or the name is ambiguous." Should I be calling this like a table function?
Thanks ahead of time.
CREATE FUNCTION TAFindTypeReturnCreateDate(@TicketID varchar(12), @TAType varchar(100)) returns DATETIME
AS
BEGIN
DECLARE @TAFindTypeReturnCreateDate DATETIME
DECLARE tTAFindTypeReturnCreateDate CURSOR FOR
SELECT DISTINCT TICKETACTIVITY.CREATEDATE
FROM TICKETACTIVITY INNER JOIN
 ICKLIST ON TICKETACTIVITY.ACTIVITYTYPECODE = PICKLIST.ITEMID
WHERE TicketID = @TicketID AND Picklist.Text LIKE @TAType
OPEN tTAFindTypeReturnCreateDate
FETCH NEXT from tTAFindTypeReturnCreateDate INTO @TAFindTypeReturnCreateDate
CLOSE tTAFindTypeReturnCreateDate
DEALLOCATE tTAFindTypeReturnCreateDate
RETURN @TAFindTypeReturnCreateDate
END
--------=========== VIEW
CREATE VIEW sysdba.vRateReviewDate AS
SELECT DISTINCT dbo.TAFindTypeReturnCreateDate(TicketID, 'Rate Review') AS RRCompleteDate, TicketID
FROM sysdba.TICKET