Hello
bcp dbname..testload in c:\"cnet Reports"\abc.txt -T -r \n -S SERVERA
Since dir has a space (i.e name of the dir is 2 words with a space between
them)
C:\cnet reports
Tried C:\"cnet reports"\
c:\'cnet reports'\
gives error
How to specify a dir that has a space in it
works OK if dir does NOT have a space.
Thanks
Basheerbcp pubs.dbo.authors in "c:\cnet Reports\abc.txt -T -r \n -S SERV"
Quotes around the whole path.
"Basheer" <Basheer@.discussions.microsoft.com> wrote in message
news:9F87DA0B-1BC6-4A07-97C7-F0F99DB0EE63@.microsoft.com...
> Hello
> bcp dbname..testload in c:\"cnet Reports"\abc.txt -T -r \n -S SERVERA
> Since dir has a space (i.e name of the dir is 2 words with a space between
> them)
> C:\cnet reports
> Tried C:\"cnet reports"\
> c:\'cnet reports'\
> gives error
> How to specify a dir that has a space in it
> works OK if dir does NOT have a space.
> Thanks
> Basheer
>|||Hi,
Use the double quotes till the end of file name.
BCP MASTER..SYSOBJECTS OUT "C:\HARI
F1\HARI.TX" -Uuser -Ppassword -SServername -c
Thanks
Hari
SQL Server MVP
"Basheer" <Basheer@.discussions.microsoft.com> wrote in message
news:9F87DA0B-1BC6-4A07-97C7-F0F99DB0EE63@.microsoft.com...
> Hello
> bcp dbname..testload in c:\"cnet Reports"\abc.txt -T -r \n -S SERVERA
> Since dir has a space (i.e name of the dir is 2 words with a space between
> them)
> C:\cnet reports
> Tried C:\"cnet reports"\
> c:\'cnet reports'\
> gives error
> How to specify a dir that has a space in it
> works OK if dir does NOT have a space.
> Thanks
> Basheer
>
2012年2月25日星期六
bcp copying,but no file
DECLARE @.query NVARCHAR(2000)
SELECT @.query = 'bcp "SELECT * from dbname..tablename" queryout c:\test.txt -c -Slocalhost -Usa -Ppassword'
EXEC master.dbo.xp_cmdshell @.query
I have tried doing this with a test table and this is the output
NULL
Starting copy...
NULL
3 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total 16
NULL
and I did have 3 row,but file is still not created, I have put the server name,login,pasword inside "" and without it,no error,no file.
Could somebody please help meWhere are you looking for the file?
SELECT @.query = 'bcp "SELECT * from dbname..tablename" queryout c:\test.txt -c -Slocalhost -Usa -Ppassword'
EXEC master.dbo.xp_cmdshell @.query
I have tried doing this with a test table and this is the output
NULL
Starting copy...
NULL
3 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total 16
NULL
and I did have 3 row,but file is still not created, I have put the server name,login,pasword inside "" and without it,no error,no file.
Could somebody please help meWhere are you looking for the file?
2012年2月18日星期六
BCP - Truncate error
I have a table with 22million rows. I bcp out using the
following
bcp dbname..table out table.out -c -T -Sserver
The file is created no problem.
When I try and run against another server (table schema
the same) I get the following error.
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data,
right truncation
Now I tried to define the column datatype, but when I
tried to enter one for Varchar, it wasn't a valid datatype
for BCP - Could this be why I'm receving the error?
Any help would be appreciated.
Thanks
SusanOr the "N" switch.
>--Original Message--
>I have a table with 22million rows. I bcp out using the
>following
>bcp dbname..table out table.out -c -T -Sserver
>The file is created no problem.
>When I try and run against another server (table schema
>the same) I get the following error.
>SQLState = 22001, NativeError = 0
>Error = [Microsoft][ODBC SQL Server Driver]String data,
>right truncation
>Now I tried to define the column datatype, but when I
>tried to enter one for Varchar, it wasn't a valid
datatype
>for BCP - Could this be why I'm receving the error?
>Any help would be appreciated.
>Thanks
>Susan
>
>.
>
following
bcp dbname..table out table.out -c -T -Sserver
The file is created no problem.
When I try and run against another server (table schema
the same) I get the following error.
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data,
right truncation
Now I tried to define the column datatype, but when I
tried to enter one for Varchar, it wasn't a valid datatype
for BCP - Could this be why I'm receving the error?
Any help would be appreciated.
Thanks
SusanOr the "N" switch.
>--Original Message--
>I have a table with 22million rows. I bcp out using the
>following
>bcp dbname..table out table.out -c -T -Sserver
>The file is created no problem.
>When I try and run against another server (table schema
>the same) I get the following error.
>SQLState = 22001, NativeError = 0
>Error = [Microsoft][ODBC SQL Server Driver]String data,
>right truncation
>Now I tried to define the column datatype, but when I
>tried to enter one for Varchar, it wasn't a valid
datatype
>for BCP - Could this be why I'm receving the error?
>Any help would be appreciated.
>Thanks
>Susan
>
>.
>
订阅:
博文 (Atom)