dynamic columns in CLR table-valued-function

F

Frank Uray

Hi all

I think this question was discused quite often before.
But maybe some "good-brain" has a great idea ... :)))

I have a DataSet with "unknown" columns.

The CLR Function should work like the normal TVF:
ALTER FUNCTION [dbo].[fncTest] ()
RETURNS TABLE
AS
RETURN
(SELECT * FROM sys.objects)

Any ideas or comments on that ??

Thanks and best regards
Frank Uray
 
C

Ciaran O''Donnell

There isnt a lot of information in your question to base an answer on. What
exactly is it you are trying to acheive and why do you want to use a SQLCLR
function to achieve it.?
 
D

Duggi

Hi all

I think this question was discused quite often before.
But maybe some "good-brain" has a great idea ... :)))

I have a DataSet with "unknown" columns.

The CLR Function should work like the normal TVF:
ALTER FUNCTION [dbo].[fncTest] ()
RETURNS TABLE
AS
RETURN
(SELECT * FROM sys.objects)

Any ideas or comments on that ??

Thanks and best regards
Frank Uray

I think DataSet contains tables and table contains rows.

Please correct me if I am wrong.

-Cnu
 
F

Frank Uray

Hello

Maybe my question was not clear.

The goal is to create a SQL Function like:
SELECT *
FROM SqlFunction ('C:\temp\test.csv')

This function should give the .csv table based back.

The problem is:
Of corse, it is easy to create in the CLR a DataSet
with all the rows and columns.
But there is now way to have a CLR Function
with dynamic columns because I dont know
what columns are in the .csv.

I did it alrady with a SQL Procedure,
but in the case I always have to select
like: SELECT * FROM openquery(servername, 'EXEC TheStoredProcedure').

I hope this is more explaining.

Best regards
Frank

Frank Uray said:
Hi all

I think this question was discused quite often before.
But maybe some "good-brain" has a great idea ... :)))

I have a DataSet with "unknown" columns.

The CLR Function should work like the normal TVF:
ALTER FUNCTION [dbo].[fncTest] ()
RETURNS TABLE
AS
RETURN
(SELECT * FROM sys.objects)

Any ideas or comments on that ??

Thanks and best regards
Frank Uray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top