Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BCP and Database name with '/' in name

Status
Not open for further replies.
Sep 13, 2001
11
US
I know, I know...

Why do I have a database with a '/' in the name.
But I do and with many processes already built around it, so renaming the db is out (for now anyway).

This is the offending database name:
deposit/loans

My trouble is trying to bcp in a data file as such:

bcp deposit/loans.dbo.dbtablename in c:\filename.txt -c -t "~" -S SERVERNAME -T

Error comes back as incorrect syntax (of course) near '/'.
I tried brackets around the name in bcp but that does not work either.

Any thoughts on getting this to work would be greatly appreciated!!
 
In the worst case create a staging DB
BCP into there and then extract the data from that DB
deposit/loans is not SqlserverInstanceName/dbname?

“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
 
SQLDenis - Thanks for the tip.

However, wouldn't you know, I Googled again and found this Microsoft reference that exactly addressed funky db and table names just by adding another command line parameter:


By using the -q parameter and double quoting my db name string it worked immediately (deposit/loans was the offending db name):

bcp "deposit/loans.dbo.tablename" in c:\triumph\siclfiles\imextr00.txt -c -q -t ~ -S GLDSQL1 -T

Isn't it always the way that you find the answer right in front of you after you give up.

Thanks again though SQLDenis!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top