Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-08-26 : 11:20:54
|
| Sameer writes "Here's my problem. I have data to transfer between 2 servers from a delimited text file to a SQL Server 7.0 table. 1. A database server (called dbBank) running SQL Server7.0 - lets name it dbs 2. An IIS Server which contains the text file to be uploaded. - lets name it IIS. The dbBank database has a table called tblBank : BankCode varchar(15) BankName varchar(100) BankType char(1). A text file named txtBank that has to be uploaded is located on C drive of the IIS Server PC: (Sample) Bk1|Bank Name One|C Bk2|Bank Name Two|C Bk3|Bank Name Three|I I ran the following statement from the command prompt of DBS : bcp dbBank..tblBank in \\IIS\C\txtbank.txt -Sdbs -Usa -P This command prompts me to create a format file which I then save as fmtBank.fmt on the C drive of the IIS Server PC. I then run the following command from the Command Prompt of DBS. bcp dbBank..tblBank in \\IIS\C\txtbank.txt -f\\IIS\C\fmtBank.fmt -Sdbs -Usa -P This works perfectly well and my table gets populated with all the records in the text file. Then I opened up the Query Analyzer and ran the same command by attaching it to xp_cmdshell : execute master..xp_cmdshell 'bcp dbBank..tblBank in \\IIS\C\txtbank.txt -f\\IIS\C\fmtBank.fmt -Sdbs -Usa -P' I get the message "The command(s) completed successfully" but no records have been inserted to the table. I have ended up spending an obscene amount of time trying to figure this out but to no avail. I'll greatly appreciate any help I can get on this problem soon. PS: When I run exactly the same command from my SQLServer7.0 Desktop version it populates the table in dbs from the IIS text file and the transfer between IIS and dbs completes perfectly. execute master..xp_cmdshell 'bcp dbBank..tblBank in \\IIS\C\txtbank.txt -f\\IIS\C\fmtBank.fmt -Sdbs -Usa -P' " |
|
|
|
|
|