Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, April 23, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Data & Imports Forums - T-SQL & Queries
Forum to discuss general T-SQL questions and help with queries related to SalesLogix data. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to T-SQL & Queries | New ThreadView:  Search:  
 Author  Thread: Passing 2 variables and returning 1.
Michael Rivera
Posts: 41
 
Passing 2 variables and returning 1.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Mar 12 12:05 PM
fiogf49gjkf0d

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


 


 


 


 


 


 

[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Passing 2 variables and returning 1.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Mar 12 7:57 PM
fiogf49gjkf0d

The Returns clause defines the local variable that will be returned by the Function. Your Define statement REDEFINES the already defined local variable.


 


If you want to return more than value, then the Returns clause should return a Table variable....

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 4/23/2024 3:00:50 PM