Home Forums SQL Server 2008 SQL Server Newbies Convert VBA Function to T-SQL or some other object - what would be best? RE: Convert VBA Function to T-SQL or some other object - what would be best?

  • Mile Higher Than Sea Level (6/21/2013)


    Yes it is an integer.

    What I am attempting to return is a True / False (meta data) - not the actual records.

    THANKS!! A function - why didn't I think of that?

    Have not thought of a function, that is a great solution that matches my Access side.

    Next question: Can a function be called directly in a TSQL Query?

    My goal is to have many functions that return a True/False.

    They all use the identical ID_Building as the argument.

    The idea is to receive a single record with the ten columns of True/False

    e.g. 29992 T T T F F F T T F T

    Each of these function results feed a Dashboard about regulatory data in the user interface.

    Can SQL functions be called directly in a SQL TSQL query statement?

    A simple example would probably get me up and running.

    It is important to understand that what I put together is not a scalar function. It is an inline table valued function. That means you can join to it just like a table. You would have to join to it multiple times in your query.

    You might want to check BOL for table valued functions. It will provide far better details than I can rattle off.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/