bcp command

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MATTXtwo
    New Member
    • Sep 2006
    • 83

    bcp command

    is't true bcp command is use to import/export data from database to plain text file?
    if not can i have to know each syntax to use importing data from certain column of excel file to database
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Here you go




    -- CK

    Comment

    • MATTXtwo
      New Member
      • Sep 2006
      • 83

      #3
      Code:
      /*sp_configure 'Ad Hoc Distributed Queries', 1 
      reconfigure 
      SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 
         'Excel 8.0;Database=C:\structure.xls', Peribadi$)
      ERR:
      Msg 15281, Level 16, State 1, Line 3
      SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online. 
      */
      SELECT * FROM OPENQUERY(EXCELLINKS, 'SELECT * FROM [Peribadi$]')
      /*Msg 102, Level 15, State 1, Line 1
      Incorrect syntax near '\'.
      Msg 7399, Level 16, State 1, Line 9
      The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "EXCELLINK" reported an error. The provider did not give any information about the error.
      -+OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "EXCELLINK" returned message "Could not find installable ISAM.".
      -+OLE DB provider "SQLNCLI" for linked server "EXCELLINKS" returned message "Invalid connection string attribute".
      Msg 7303, Level 16, State 1, Line 9
      Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "EXCELLINK".
      */
      Nope...I had enough.....bett er with DTS/SSIS

      Comment

      Working...