About BCP.exe | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

About BCP.exe

I want to run the BCP.exe to import data every day at my application’s user’s computer.
So I try to copy the files Bcp.exe and Bcp.rll to a folder of the user’s computer,and run this code:
BCP database_name.dbo.table_name in c:file.txt -S[host name] -Usqlserver_user -Ppwd I can connected to the Database,but when i run the code ,it showed me a error message:
SQLState = S1000,Native Error = 0
Error = [Microsoft][ODBC SQL Server Driver]ODBCBCP /Driver version mismatch. Note:I don’t install any SQL Server product in the user’s computer.and the code can run successful in my computer. Many thanks for any help. Jelly.
I’ve read similar problems on the groups.
Most of the times the advice given is to ensure that sqlsrv32.dll and odbcbcp.dll have the same version number on the computer. If they don’t then reapply MDAC onto the pc. Cheers
Shaun World Domination Through Superior Software
Yes,i installed MDAC onto the pc.but it still showed me the same error message.
whether I don’t copy some impoartant files to the pc? Jelly.
Check this KBA http://support.microsoft.com/default.aspx?scid=kb;en-us;Q325765&gssnb=1] for information. _________
Satya SKJ

Just in case you run into further trouble with the BCP client tool you can refer to this very good ODBC error (and other things) site: http://www.legalkey.com/ErrRef/Odbc/ODBCErrorReference.htm] NHO
How to see the versions of sqlsrv32.dll and odbcbcp.dll ? Jelly.
From Windows Explorer first of all enable option to show hidden and system files. Then right click on the specified file and goto Version tab to see the information. _________
Satya SKJ

Yeah,Many thanks for your help.<br />Now i can make sqlsrv32.dll and odbcbcp.dll have the same version number,but i still receive the same error message.<br /><br />So,I want to change a method:use OPENDATASOURCE function.<br />I wrote a code like this:<br /><br />INSERT INTO table_name <br />(SELECT * <br />FROM OpenDataSource( ‘Microsoft.Jet.OLEDB.4.0’,<br /> ‘Data Source="D:Jelly";User ID=Admin<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />assword=;Extended erties=text’)<br /> …030210.txt )<br /><br />I was so shamed that I didn’t how to write the correct syntax. <br />Please help me.<br /><br />Jelly.
Are u referring OPENDATASOURCE OR OPENROWSET if it is rowset please find ref in <br />Sql server books online topic is – OPENROWSET.<br /><br /><blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by Jelly0228</i><br /><br />Yeah,Many thanks for your help.<br />Now i can make sqlsrv32.dll and odbcbcp.dll have the same version number,but i still receive the same error message.<br /><br />So,I want to change a method:use OPENDATASOURCE function.<br />I wrote a code like this:<br /><br />INSERT INTO table_name <br />(SELECT * <br />FROM OpenDataSource( ‘Microsoft.Jet.OLEDB.4.0’,<br /> ‘Data Source="D:Jelly";User ID=Admin<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />assword=;Extended erties=text’)<br /> …030210.txt )<br /><br />I was so shamed that I didn’t how to write the correct syntax. <br />Please help me.<br /><br />Jelly.<br /><hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote"><br /><br />Rushendra
Yes,I can select the data use OPENROWSET.
But I want to use OPENDATASOURCE.if I use OPENROWSET function,I won’t see the first data from the result. Jelly.
Now I can select the data from the file of .txt use OPENROWSET AND OPENDATASOURCE.<br />—-OPENROWSET<br /> SELECT * FROM <br /> OPENROWSET(‘MICROSOFT.JET.OLEDB.4.0’, <br /> ‘Text;Database=D:Jelly;’, <br /> ‘SELECT * FROM [030210#txt]’) <br /><br />—-OPENDATASOURCE<br />SELECT * FROM <br /> OpenDataSource( ‘Microsoft.Jet.OLEDB.4.0’,<br /> ‘Data Source="D:Jelly";User ID=Admin<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />assword=;Extended properties=text’)…[030210#txt]<br /><br />I found OPENROWSET is quickler than OPENDATASOURCE.<br /><br />But I have an other problem:<br />The functions make some columns and convert the data type to number automatic,I just want to get one column and make the data type be varchar.<br /><br /><br />Jelly.
Than select just the column you need and convert it to varchar <img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ /><br />SELECT CONVERT(varchar, column_name) FROM ….<br /><br />Bambola.
Please refer the comment and concerns of using opendatasource posted by VBKENYA <br />in Performance tuning for developers topic is <br />Reading and Excel file<br /><br /><blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by Jelly0228</i><br /><br />Now I can select the data from the file of .txt use OPENROWSET AND OPENDATASOURCE.<br />—-OPENROWSET<br /> SELECT * FROM <br /> OPENROWSET(‘MICROSOFT.JET.OLEDB.4.0’, <br /> ‘Text;Database=D:Jelly;’, <br /> ‘SELECT * FROM [030210#txt]’) <br /><br />—-OPENDATASOURCE<br />SELECT * FROM <br /> OpenDataSource( ‘Microsoft.Jet.OLEDB.4.0’,<br /> ‘Data Source="D:Jelly";User ID=Admin<img src=’/community/emoticons/emotion-4.gif’ alt=’;P’ />assword=;Extended properties=text’)…[030210#txt]<br /><br />I found OPENROWSET is quickler than OPENDATASOURCE.<br /><br />But I have an other problem:<br />The functions make some columns and convert the data type to number automatic,I just want to get one column and make the data type be varchar.<br /><br /><br />Jelly.<br /><hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote"><br /><br />Rushendra
Hi,guys,
I am so glad to tell you a good message.
I’ve finished this work about import data from .txt to SQL Server with BCP.EXE.
Except install MDAC,I also updated SQLSRV32.DLL:Just copied this file from my computer to user’s pc.then it was seccessfully.So I think maybe MDAC won’t update SQLSRV32.DLL(right?).
Many thanks for all guys!
Jelly.
]]>

Software Reviews | Book Reviews | FAQs | Tips | Articles | Performance Tuning | Audit | BI | Clustering | Developer | Reporting | DBA | ASP.NET Ado | Views tips | | Developer FAQs | Replication Tips | OS Tips | Misc Tips | Index Tuning Tips | Hints Tips | High Availability Tips | Hardware Tips | ETL Tips | Components Tips | Configuration Tips | App Dev Tips | OLAP Tips | Admin Tips | Software Reviews | Error | Clustering FAQs | Performance Tuning FAQs | DBA FAQs |