table-udf

Execute table-valued function on multiple rows?

Given a table-valued function such as dbo.Split() from "T-SQL: Opposite to string concatenation - how to split string into multiple records", how do I pass multiple rows as arguments? This works: SELECT * FROM dbo.Split (',', (SELECT myColumn FROM Stuff WHERE id = 22268)) WHERE ISNULL(s,'') <> '' It returns: pn s --------...

How to create a UDF that takes a query string and returns the query's resultset

I want to create a stored procedure that takes a simple SELECT statement and return the resultset as a CSV string. So the basic idea is get the sql statement from user input, run it using EXEC(@stmt) and convert the resultset to text using cursors. However, as SQLServer doesn't allow: select * from storedprocedure(@sqlStmt) UDF with E...

How to retrieve metadata for return values of an sql server inline table-valued function?

It's not in INFORMATION_SCHEMA.COLUMNS, so where is it? This is a schemabound inline table valued function, so it doesn't have the issues which a stored procedure might have in being able to vary its output schema(s) based on parameters. ...

Multi-statement Table Valued Function vs Inline Table Valued Function

A few examples to show, just incase: Inline Table Valued CREATE FUNCTION MyNS.GetUnshippedOrders() RETURNS TABLE AS RETURN SELECT a.SaleId, a.CustomerID, b.Qty FROM Sales.Sales a INNER JOIN Sales.SaleDetail b ON a.SaleId = b.SaleId INNER JOIN Production.Product c ON b.ProductID = c.ProductID WHERE a.ShipDate IS...

SQL Server Multi-statement UDF - way to store data temporarily required

Hello, I have a relatively complex query, with several self joins, which works on a rather large table. For that query to perform faster, I thus need to only work with a subset of the data. Said subset of data can range between 12 000 and 120 000 rows depending on the parameters passed. More details can be found here: http://stackoverf...

Rowset functions in Firebird

I have table like data coming from a c++ module and I want to use this in Firebird SQL queries/stored procedure. Firebird allows hooking c++ code through UDFs. But it can return only a single value. I am planning to return xml string value from UDF, populate this in global table and use it for any use. Is this right way of doing? Are t...

Returning a table from a UDF (in C)

Hi, I'm trying to write a UDF in C that inserts values into a table and returns this table. The bigger picture is: I parse some document and set up a "parse table" (essentially this is the relational representation of the parse tree of the document parsed). After having inserted the parsing information into the parse table I need the UD...