MarkButler
Programmer
I have a database with a table within it that I want to extract into a text file. On my laptop I have the database defined and have no problem with the following command. The difference is that on my laptop the database name is test and on the actual server it is a numeric name. I beleive that to be my problem.
On the laptop I can issue the command as follows:
I am actually constructing the name in a stored procedure as follows. On the test machine vs the production machine the only difference in the command is the database name which is test vs 10245.
I have added quotes and brackets around the database name and the database and table name without success. What am I missing?
TIA
Mark
Code:
DECLARE @xp_cmd varchar (500)
SET @xp_cmd = 'BCP "10245..web_employer" out web_em.txt -c'
EXEC master..xp_cmdshell @xp_cmd
On the laptop I can issue the command as follows:
Code:
SET @xp_cmd = 'BCP test..web_employer out web_em.txt -c'
I am actually constructing the name in a stored procedure as follows. On the test machine vs the production machine the only difference in the command is the database name which is test vs 10245.
Code:
SET @xp_cmd = 'BCP ' + db_name() +'..' + @table_name + ' out ' + @text_file + ' -c'
I have added quotes and brackets around the database name and the database and table name without success. What am I missing?
TIA
Mark