Help with TEXTCOPY

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Zack Sessions

    Help with TEXTCOPY

    I know it may not be good design standards, but SQL7 can handle
    database names that have embedded spaces just fine, you just need to
    enclose the database name in square brackets. But can TEXTCOPY handle
    spaces in the database name?

    I first tried something like:

    TEXTCOPY /S server /U sa /P password /D mydatabase /t [table name]
    /C columnname /W "where id = 1" /F file.txt /O

    Ultimate goal here is to extract the text contents from the column
    columnname and write it to a file called file.txt. But the command
    puked on the square brackets. I tried the same command structured like
    this:

    TEXTCOPY /S server /U sa /P password /D mydatabase /t "table name"
    /C columnname /W "where id = 1" /F file.txt /O

    But it didn't like that either. Any suggestions? I ended up renaming
    the table to a table name without any spaces, like table_name, but I
    would rather have not solved the situation in that manner.
  • Erland Sommarskog

    #2
    Re: Help with TEXTCOPY

    Zack Sessions (zcsessions@vis ionair.com) writes:[color=blue]
    > I know it may not be good design standards, but SQL7 can handle
    > database names that have embedded spaces just fine, you just need to
    > enclose the database name in square brackets. But can TEXTCOPY handle
    > spaces in the database name?
    >
    > I first tried something like:
    >
    > TEXTCOPY /S server /U sa /P password /D mydatabase /t [table name]
    > /C columnname /W "where id = 1" /F file.txt /O
    >
    > Ultimate goal here is to extract the text contents from the column
    > columnname and write it to a file called file.txt. But the command
    > puked on the square brackets. I tried the same command structured like
    > this:
    >
    > TEXTCOPY /S server /U sa /P password /D mydatabase /t "table name"
    > /C columnname /W "where id = 1" /F file.txt /O
    >
    > But it didn't like that either. Any suggestions? I ended up renaming
    > the table to a table name without any spaces, like table_name, but I
    > would rather have not solved the situation in that manner.[/color]

    I think you need "[table name]". The "" are needed to get CMD.EXE to
    understand that this is one argument, not two. And then you need the
    brackets to make T-SQL happy.



    --
    Erland Sommarskog, SQL Server MVP, sommar@algonet. se

    Books Online for SQL Server SP3 at
    SQL Server 2025 redefines what's possible for enterprise data. With developer-first features and integration with analytics and AI models, SQL Server 2025 accelerates AI innovation using the data you already have.

    Comment

    Working...