SQL Server Performance

About BCP.exe

Discussion in 'General DBA Questions' started by Jelly0228, Jun 1, 2003.

  1. Jelly0228 New Member

    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.
  2. trifunk New Member

    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
  3. Jelly0228 New Member

    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.
  4. satya Moderator

  5. vbkenya New Member

  6. Jelly0228 New Member

    How to see the versions of sqlsrv32.dll and odbcbcp.dll ?

    Jelly.
  7. satya Moderator

    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
  8. Jelly0228 New Member

    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.
  9. rushmada New Member

    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
  10. Jelly0228 New Member

    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.
  11. Jelly0228 New Member

    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.
  12. bambola New Member

    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.
  13. rushmada New Member

    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
  14. Jelly0228 New Member

    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.

Share This Page