Search code examples
c#sql-serverclr

Returning table with CLR


I want to write an CLR procedure which takes a text and returns a table with all the words in this text. But I can't figure out how to return a table. Could you please tell me it?

    [Microsoft.SqlServer.Server.SqlFunction]
    public static WhatTypeShouldIWriteHere Function1(SqlString str)
    {
        string[] words = Regex.Split(str, @"\W+").Distinct().ToArray();
        //how to return a table with one column of words?
    }

Thank you for your help.

UPDATED: I need to do it for sql-2005


Solution

  • You can return any list that implements an IEnumerable. Check this out.