Home Forums SQL Server 2005 T-SQL (SS2K5) dynamic object(database/schema/obj) in stored procedure RE: dynamic object(database/schema/obj) in stored procedure

  • Does this help???

    table variables provide the following benefits:

    A table variable behaves like a local variable. It has a well-defined scope. This is the function, stored procedure, or batch that it is declared in.

    Within its scope, a table variable can be used like a regular table. It may be applied anywhere a table or table expression is used in SELECT, INSERT, UPDATE, and DELETE statements. However, table cannot be used in the following statement:

    SELECT select_list INTO table_variable

    table variables are automatically cleaned up at the end of the function, stored procedure, or batch in which they are defined.

    CHECK constraints, DEFAULT values and computed columns in the table type declaration cannot call user-defined functions.

    table variables used in stored procedures cause fewer recompilations of the stored procedures than when temporary tables are used.

    Transactions involving table variables last only for the duration of an update on the table variable. Therefore, table variables require less locking and logging resources.

    http://msdn.microsoft.com/en-us/library/ms175010.aspx%5B/url%5D