Re: BCP command where the arguments have a special char

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Dan Guzman (guzmanda_at_nospam-online.sbcglobal.net)
Date: 11/04/04


Date: Thu, 4 Nov 2004 07:42:03 -0600

I made a copy/paste error in the example. The direction should be
'queryout':

BCP "SELECT * FROM [asdos+_reports]..StageCONTACTINFO" queryout
C:\16E8.tmp -w -b10000 -t"|" -r\n -Sblrkec28791d\sqlserver -Uadmin -Padmin -eC:\ERRCONTACTINFO.txt

-- 
Hope this helps.
Dan Guzman
SQL Server MVP
"Sundar" <Sundar@discussions.microsoft.com> wrote in message 
news:163DBC82-BE15-4777-853B-B98E93620A8C@microsoft.com...
>I tried the cmd as given but got the following error,
>
>    Copy redirection should be either 'IN' or 'OUT'
>
> where should i give the 'OUT'?
>
> TIA
>
> "Dan Guzman" wrote:
>
>> Try queryout like the example below.  You can avoid issues like this by
>> ensuring your database and object names conform to the rules for 
>> identifiers
>> as described in the Books Online.
>>
>> BCP "SELECT * FROM [asdos+_reports]..StageCONTACTINFO" query
>> C:\16E8.tmp -w -b10000 -t"|" -r\n -Sblrkec28791d\sqlserver -Uadmin -Padmin 
>>  -eC:\ERRCONTACTINFO.txt
>>
>>
>> -- 
>> Hope this helps.
>>
>> Dan Guzman
>> SQL Server MVP
>>
>> "Deepu V" <DeepuV@discussions.microsoft.com> wrote in message
>> news:A4DFDDB3-5310-49F5-8480-9C41EA25182D@microsoft.com...
>> > Hi all,
>> >
>> > The command is as follows:
>> >
>> > BCP asdos+_reports..StageCONTACTINFO OUT 
>> > C:\16E8.tmp -w -b10000 -t"|" -r\n
>> > -Sblrkec28791d\sqlserver -Uadmin -Padmin -eC:\ERRCONTACTINFO.txt
>> >
>> >   Here, since the first argument(database name) has a special char '+' 
>> > in
>> > it, the command gives a syntax error. How can i escape it? Double
>> > quotes"",
>> > [] didnt work!!  Pls help!
>> >
>> > TIA
>>
>>
>> 


Relevant Pages

  • Re: Save as in SQL Server(Backup - Restore)
    ... "Dan Guzman" wrote in message ... > SQL Server MVP ... I take it you already know about the RESTORE command ... >>> Tibor Karaszi, SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Job owned by a non-sysadmin fails to run
    ... Looks like I have a problem with CmdExec jobs in general. ... I changed the step command to "dir c:\temp" and it ran fine when owned by an ... Dan Guzman ... SQL Server MVP ...
    (microsoft.public.sqlserver.security)
  • Re: VBscript Timed out
    ... Do you know how to return the Connection Timeout value ... > property of the ADO Command object. ... > Dan Guzman ... > SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Status Column in sysobjects table...SQL2000
    ... Please post a sample proc that demonstrates the ... >> Dan Guzman ... >> SQL Server MVP ... even though there are no compilation errors. ...
    (microsoft.public.sqlserver.programming)
  • Re: INSERT datetime field into database
    ... type varchar to datatime.". ... SQL Server MVP ... INSERT datetime field into database ... Dan Guzman wrote: ...
    (microsoft.public.sqlserver.programming)