How to get result query in each row of a column in Table using sqlserver

  • I have one table name is TABLE, it has id and query two fields

    as

    follows

    id query

    1000 select count(*) from emp1

    2000 select count(*) from emp2

    ..

    While executing , i want result as follows

    id query

    1000 20(i want number rows here for example i gave here 20)

    2000 22

  • are emp1 and emp2 separate tables?

    Otherwise,

    Select t.id,

    count(*) as EmpCt

    from TABLE t

    group by t.id

  • Probably not without some convoluted dynamic sql since it looks like you want to exec the query stored in the table as part of selecting data from the table.

  • Yes emp1 and emp2 are separate tables.

    While executing , i want display result of each query output in integer.

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

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