SQL textcopy command with ColumnName as "File"

Posted on 2012-09-03
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:Dushan911
    LVL 31

    Accepted Solution

    Try putting file in square brackets [file]
    LVL 9

    Expert Comment

    Put the single quotes likes this 'form.pdf'

    Also refer this
    LVL 17

    Author Comment

    Thanks a lot!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Suggested Solutions

    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now