Copying To or From a Temporary Table

When using bcp or BULK INSERT to bulk copy data using a global temporary table, the table name must be specified at the command prompt, including initial number signs (##). For example, to bulk copy data from the global temporary table ##temp_authors to the Temp_authors.txt data file, execute at the command prompt:

bcp ##temp_authors out temp_authors.txt -c -Sservername -Usa -Ppassword

  

However, do not specify the database name when using global temporary tables because temporary tables only exist in tempdb. It is only possible to use a local temporary table (for example, #temp_authors) when bulk copying data using the BULK INSERT statement.

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.