From the error I take, that the data file cannot be opened:
C:\Users\Serge>BCP Testing.bdo.Exporttable out "C:\Users\Serge\Desktop\MyFile.txt" -C -T
I think, you have to add a filename behind the \Desktop
. Desktop is an existing directory and cannot be opened as file …
And – btw – it might be necessary to add -S Servername
…
UPDATE
Found this here
Whenever I get this message, it’s because of one of three things:
1) The path/filename is incorrect (check your typing / spelling)
2) The file does not exist. (make sure the file is where you expect it to be)
3) The file is already open by some other app. (close the other app to release the file)
For 1) and 2) – remember that paths are relative to where bcp is executing. Make sure that bcp.exe can access the file/path from it’s context.
/Kenneth
Related Posts:
- Inserting multiple rows in a single SQL query? [duplicate]
- What do Clustered and Non-Clustered index actually mean?
- SQL query to get the employee name and their manager name from the same table
- T-SQL split string
- The SQL OVER() clause – when and why is it useful?
- Update multiple columns in SQL
- SQL Server IF EXISTS THEN 1 ELSE 2
- SQL Query with SUM with Group By
- How do I perform an IF…THEN in an SQL SELECT?
- SQL update from one Table to another based on a ID match
- An attempt was made to access a socket in a way forbidden by its access permissions
- Conversion of a varchar data type to a datetime data type resulted in an out-of-range value in SQL query
- Each GROUP BY expression must contain at least one column that is not an outer reference
- How to drop all tables from a database with one SQL query?
- SQL Server : Arithmetic overflow error converting expression to data type int
- Optimistic vs. Pessimistic locking
- How to calculate percentage with a SQL statement
- The target principal name is incorrect. Cannot generate SSPI context
- Query comparing dates in SQL
- The EXECUTE permission was denied on the object ‘xxxxxxx’, database ‘zzzzzzz’, schema ‘dbo’
- What is the meaning of the prefix N in T-SQL statements and when should I use it?
- How can I clone an SQL Server database on the same server in SQL Server 2008 Express?
- Query error with ambiguous column name in SQL
- SQL Server : error converting data type varchar to numeric
- How to drop all tables from a database with one SQL query?
- How to find sum of multiple columns in a table in SQL Server 2005?
- Conversion failed when converting from a character string to uniqueidentifier – Two GUIDs
- Keeping it simple and how to do multiple CTE in a query
- How can I delete using INNER JOIN with SQL Server?
- Why use a READ UNCOMMITTED isolation level?
- Conversion of a varchar data type to a datetime data type resulted in an out-of-range value in SQL query
- CREATE TABLE IF NOT EXISTS equivalent in SQL Server
- How can I import an Excel file into SQL Server?
- How to group by month from Date field using sql
- sql server invalid object name – but tables are listed in SSMS tables list
- SQL – The conversion of a varchar data type to a datetime data type resulted in an out-of-range value
- How can I get column names from a table in SQL Server?
- Is there a combination of “LIKE” and “IN” in SQL?
- How to get a date in YYYY-MM-DD format from a TSQL datetime field?
- Search text in stored procedure in SQL Server
- How to convert SQL Server’s timestamp column to datetime format
- Arithmetic overflow error converting expression to data type datetime. (while displaying date time..)
- MS SQL compare dates?
- MS SQL compare dates?
- ClassNotFoundException – com.microsoft.jdbc.sqlserver.SQLServerDriver
- How do I fix ‘Invalid character value for cast specification’ on a date column in flat file?
- The SELECT permission was denied on the object ‘Users’, database ‘XXX’, schema ‘dbo’
- How do you open an SDF file (SQL Server Compact Edition)?
- What is the maximum characters for the NVARCHAR(MAX)?
- Get size of all tables in database
- Using RegEx in SQL Server
- Trouble Connecting to sql server Login failed. “The login is from an untrusted domain and cannot be used with Windows authentication”
- Difference between database and schema
- Why do table names in SQL Server start with “dbo”?
- How to format a numeric column as phone number in SQL
- ‘Microsoft.ACE.OLEDB.16.0’ provider is not registered on the local machine.
- How do I fix the multiple-step OLE DB operation errors in SSIS?
- SQL Server: Error converting data type nvarchar to numeric
- SQL – WHERE (X, Y) IN (A, B)
- SQL Server Linked Server Example Query
- sql query to return differences between two tables
- How do I format a number with commas in T-SQL?
- How do I fix the error ‘Named Pipes Provider, error 40 – Could not open a connection to’ SQL Server’?
- SQL: IF clause within WHERE clause
- SQL datetime compare
- To add server using sp_addlinkedserver
- How to connect to a local database in SQL Server Management Studio?
- What are named pipes?
- How to select the last record of a table in SQL?
- SQL- Ignore case while searching for a string
- SQL WHERE.. IN clause multiple columns
- Comma separated results in SQL
- SHOWPLAN permission denied in database ‘tempdb’. in sql server 2008
- Using Excel VBA to run SQL query
- What is tableName.* in SQL
- What is the reason for the error message “System cannot find the path specified”?
- How to run powershell script from .ps1 file?
- Self Join to get employee manager name
- How can I do an UPDATE statement with JOIN in SQL Server?
- INSERT statement conflicted with the FOREIGN KEY constraint – SQL Server
- Drop a temporary table if it exists
- The filename, directory name, or volume label syntax is incorrect inside batch
- Cannot Connect to Server – A network-related or instance-specific error
- Best way to do nested case statement logic in SQL Server
- How can I truncate a datetime in SQL Server?
- SQL Server String or binary data would be truncated
- How to parse XML data in SQL server table
- What is the Oracle equivalent of SQL Server’s IsNull() function?
- Cannot open database “test” requested by the login. The login failed. Login failed for user ‘xyz\ASPNET’
- “if not exist” command in batch file
- Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 4 (Year)
- Ping with timestamp on Windows CLI
- Conversion of a datetime2 data type to a datetime data type results out-of-range value
- Errors: “INSERT EXEC statement cannot be nested.” and “Cannot use the ROLLBACK statement within an INSERT-EXEC statement.” How to solve this?
- Text was truncated or one or more characters had no match in the target code page including the primary key in an unpivot
- How can I group by date time column without taking time into consideration
- An explicit value for the identity column in table can only be specified when a column list is used and IDENTITY_INSERT is ON SQL Server
- Pad a string with leading zeros so it’s 3 characters long in SQL Server 2008
- Changing all files’ extensions in a folder with one command on Windows
- How to connect to database from Unity