• maharaj.narayanan (5/24/2014)


    hi,

    Needed a small help

    select table_name,count(*) into #temp from information.schema.table

    which will return the table name and their corresponding row count.

    i need this in a store procedure where this information should be inserted into a temp table.

    thankyou.

    Other than the fact that you don't have the required GROUP BY on that code, what's stopping you from using it in a stored procedure?

    If that's ALL that the stored procedure is going to consist of, I wouldn't bother because it's useless then. The Temp Table won't be available outside the stored proc and you really don't want to use a Global Temp Table because that will cause concurrency problems.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)