Learn how to a build a cloud-first strategyRegister Now


SQL textcopy command with ColumnName as "File"

Posted on 2012-09-03
Medium Priority
Last Modified: 2012-09-04
Hi Experts,
I have a SQL database table field named as "File" (poor file naming did by the developer).
And it's now deployed on the production.

textcopy.exe /S server01 /U user01 /P pwd01 /D DB01 /T tbl01 /C File /W "where id='999'" /Z /O /F form.pdf


Open in new window

When I try to extract the binary data on that field using text copy command it says

  debug: Query: select File from tbl01 where id='999'
SQL Server 'server01' Message 156: Incorrect syntax near the keyword 'File'.
Concerning line 1)
DB-Library Error 10007: General SQL Server error: Check messages from the SQL S
ERROR: Query execution failed.

It seems this "File" table column is identifying as a keyword. Could you please help me regarding this issue?
Question by:Dushan De Silva
LVL 31

Accepted Solution

James Murrell earned 2000 total points
ID: 38362501
Try putting file in square brackets [file]

Expert Comment

by:Vijaya Reddy Pinnapa Reddy
ID: 38362516
Put the single quotes likes this 'form.pdf'

Also refer this
LVL 17

Author Comment

by:Dushan De Silva
ID: 38362521
Thanks a lot!

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how the fundamental information of how to create a table.
Suggested Courses

804 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question