Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 5123

How to export all tables in a database using bcp and sp_msforeachtable?

$
0
0

I'm trying to use sp_msforeachtable and bcp to export all tables in a database.   The problem I have is that some of the tables have space in their names.  

For any tables which have space in their names, using sp_msforeachtable and bcp will yield the error "Copy direction must be either 'in', 'out' or 'format'."   I have no problem using sp_msforeachtable and bcp to export individual table which has space in its names so the problem is how to export all tables using the ?.


Viewing all articles
Browse latest Browse all 5123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>