• Siten0308 - Monday, March 20, 2017 4:21 PM

    Hey guys,

    need your briliant minds, sadly i dont have one 🙁 and sorry for the confused title.

    ok i have a select statement like:

    select OrderID, customer name, blah blah
    from dbo.orders

    however i am using this select statement in BIML, but dont let that throw anyone off, i am trying to say:

    select *
    from dbo.orders
    where orders in
    (
    select name
    from sys.tables
    where name like 'orders'
    )

    therefore it will complete the select statement, however if it wasnt an order table, then skip the select statement, i am really sorry if i am not explaining it right, but that is what i can think on top of my head how i can accomplish my task that BIML requires.

    what the main purpose is to dynamically do select statements for only certain tables in a database, if it meets my criteria, then do the select statement, if not, skip it.... is this possible?

    thanks in advance

    First let me tell you that I don't know BIML.

    That said, why would you want to do this?  If you already know the names of the tables, you can query them.  If you don't know the names of the tables, why would you want to query them?