locked
Import Data from BCP Files RRS feed

  • Question

  • I have a .txt file and an xml file that I have downloaded form a site (SQL BCP formatted)

    How do I import data form the file whhc would also create table from the xml file?

    I've tried the following script but it requires table to exist. I have 100s of these file and would like to use a script to automate the process.

    BULK INSERT dbo.MyTable   
       FROM 'C:\MyData\MyFile.txt'   
       WITH (FORMATFILE = 'C:\MyData\MyFile.xml');  
    GO  
    

    Thursday, November 5, 2020 11:27 PM

Answers

  • Hi Shayaan,

    Thanks for your feedback.

    >>I Googled for SQL Server forum but couldn't find it

    SQL Server forum has moved to Q&A, and you can ask your question in the following forum.

    sql-server-general

    Best Regards,

    Xingyu Zhao

     

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Shayaan Friday, November 6, 2020 4:17 PM
    Friday, November 6, 2020 7:30 AM

All replies

  • Hello,

    Please clean up your misspelled words along with showing us what code you have tried so far as we are not a code writing service.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    My GitHub code samples
    GitHub page

    Friday, November 6, 2020 1:31 AM
  • Please learn to read...

    The code was already provided and those mispelled words are still close enough for an educated person to understand my question 

    Friday, November 6, 2020 3:50 AM
  • I have just realized that my question shouldn't be in this forum since my question is realted to SQL Server.

    I Googled for SQL Server forum but couldn't find it.

    Friday, November 6, 2020 3:59 AM
  • Hi Shayaan,

    Thanks for your feedback.

    >>I Googled for SQL Server forum but couldn't find it

    SQL Server forum has moved to Q&A, and you can ask your question in the following forum.

    sql-server-general

    Best Regards,

    Xingyu Zhao

     

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Shayaan Friday, November 6, 2020 4:17 PM
    Friday, November 6, 2020 7:30 AM