Functions and Tables

  • Hi,

    I'm using the SQL Server 200 and I have a little problem, I need to

    create some procedure for get the information of distincts tables, i need

    to save this information in a TABLE variable for its processing. For

    this purpose, I'm using User-defined Functions, but i can't to use Inline

    table-valued functions because i can't to add logical to this function

    type, and I can't Multi-statement table-valued functions because i

    don't know what is the result table structure. I don't like to use

    temporally tables.

    Thanks for yours comments.

    Deusdit Correa Cornejo

    ----------------------

    Br. Computer Science

    Microsoft Certified Database Administrator

    Analyst Programmer

    ----------------------


    Deusdit Correa Cornejo
    ----------------------
    Br. Computer Science
    Microsoft Certified Database Administrator
    Analyst Programmer
    ----------------------

  • Not sure what you mean. Can you post an example?

    Steve Jones

    steve@dkranch.net

  • Well, i want to use metadata about some tables, so i need a procedure for construct the table from the metadata.

    For example, i have the table name and column name in a table, i need construct a SELECT for this table, but i need save the SELECT results in a TABLE variable for to use like a normal table.

    Deusdit Correa Cornejo

    ----------------------

    Br. Computer Science

    Microsoft Certified Database Administrator

    Analyst Programmer

    ----------------------


    Deusdit Correa Cornejo
    ----------------------
    Br. Computer Science
    Microsoft Certified Database Administrator
    Analyst Programmer
    ----------------------

  • A example, I have the follow Metadata table:

    MetadataKey, TableName, ColumnName

    1, 'ORGANIZATION', 'ORGANIZATION_KEY'

    2, 'ORGANIZATION', 'NAME'

    3, 'ORGANIZATION', 'MAX_RECORD_TIME'

    The table organization exists in my database.

    I need create a query for this table from the Metadata table, for example

    SELECT ORGANIZATION_KEY, NAME, MAX_RECORD_TIME

    FROM ORGANIZATION

    Well, i need save the result in a TABLE variable for process in other task (for example in join tables).

    So, i can change the query by insert or delete records in Metadata table. This is the reason for that i don't know what is the final structure of query and its results.

    Deusdit Correa Cornejo

    ----------------------

    Br. Computer Science

    Microsoft Certified Database Administrator

    Analyst Programmer

    ----------------------


    Deusdit Correa Cornejo
    ----------------------
    Br. Computer Science
    Microsoft Certified Database Administrator
    Analyst Programmer
    ----------------------

  • I hope to explain my problem.

    Thanks for your comments.

    Deusdit Correa Cornejo

    ----------------------

    Br. Computer Science

    Microsoft Certified Database Administrator

    Analyst Programmer

    ----------------------


    Deusdit Correa Cornejo
    ----------------------
    Br. Computer Science
    Microsoft Certified Database Administrator
    Analyst Programmer
    ----------------------

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply