Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Calling SQL function with "User-Defined Table type" as Input parameter..
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Calling SQL function with "User-Defined Table type" as Input parameter..
 Login/Join
 
Gold member
posted
Hi,

How to pass the value(in the form of table) to User-Defined Table type parameter from webfocus while calling SQL function....?

I have created a User defined function in SQL Server which is use User-Defined Table Type as input parameter.

Example
 
CREATE FUNCTION Dept_TableValuedParameterExample(@TempTable deptMaster READONLY )
RETURNS TABLE 
AS
RETURN 
 (
	SELECT * FROM dbo.emp where dept in (select deptno from @TempTable)
)
 
 

and i have the User-Defined Table type for deptmMaster in sql server.
 
CREATE TYPE deptMaster AS TABLE
(
 deptno int,
)
GO
 

if i run the below query in SQL server,iam getting the data.
 
DECLARE @MyTable deptMaster
INSERT INTO @MyTable VALUES(2)
INSERT INTO @MyTable VALUES(3)
select ename,empno,dept from Dept_TableValuedParameterExample(@MyTable)
 


but how to achieve this from webfocus...?

This message has been edited. Last edited by: Maran,


WebFOCUS 8201m
Windows,AppStudio, DevStudio,All Outputs
 
Posts: 69 | Location: India | Registered: November 03, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Hi Maran

Have you tried wrapping your SQL in a SQL Passthru?


ENGINE SQLMSS SET DEFAULT_CONNECTION connection
ENGINE SQLMSS
your SQL Code
END


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 1560 | Location: Customer Support | Registered: April 12, 2005Reply With QuoteReport This Post
Gold member
posted Hide Post
Hi Chuck Wolff,
Thanks for your reply.

Yes, we tried SQL Passthru..but unable to pass table valued parameter to SQL passthru.
Is there any way to call below SQL function from webfocus...?

User Defined Table
CREATE TYPE deptMaster AS TABLE
(
 deptno int,
)
GO

SQL function
CREATE FUNCTION Dept_TableValuedParameterExample(@TempTable deptMaster READONLY )
RETURNS TABLE 
AS
RETURN 
 (
	SELECT * FROM dbo.emp where dept in (select deptno from @TempTable)
)
 


WebFOCUS 8201m
Windows,AppStudio, DevStudio,All Outputs
 
Posts: 69 | Location: India | Registered: November 03, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Hi Maran

Can this function be saved as a SQL stored procedure. If so then you can create a synonym for the stored procedure and access it that way.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 1560 | Location: Customer Support | Registered: April 12, 2005Reply With QuoteReport This Post
Guru
posted Hide Post
Maran,
Let us know if the previous suggestion helped you out. You can also search the Focal Point forum for "Stored Procedures". You'll find several discussions on this topic.

If you have found a solution please share so that others can benefit.

Thank you for participating in the Focal Point Forum!
Tamra Colangelo
Focal Point Moderator
Information Builders


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
 
Posts: 487 | Location: Toronto | Registered: June 23, 2009Reply With QuoteReport This Post
Gold member
posted Hide Post
Hi Chuck Wolff,
Thanks you so much for your valuable solutions!!!!

Instead of calling SQL function, we used all the queries in SQL Passthru from webfocus.

Thanks


WebFOCUS 8201m
Windows,AppStudio, DevStudio,All Outputs
 
Posts: 69 | Location: India | Registered: November 03, 2015Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Calling SQL function with "User-Defined Table type" as Input parameter..

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.