word document to sql table

  • hi

    i want to insert data from word doc to my sql table there are four fields in my

    sql table

    my word file contain

    News

    Date

    Title

    Subject

    when i saving the word doc i want to insert the data to sql table contain same field

    (News,Date,Title,Subject)

    any idea

    please replay

  • From this web site

    http://www.sqlmag.com/Articles/Index.cfm?ArticleID=23911&DisplayTab=Article

    Word has no OLE DB provider, so Data Transformation Services (DTS) can't easily access a Word document. Your best bet is to write a VBScript macro to connect Word to SQL Server. Using the VBScript macro, you can load the data directly into SQL Server without using a SQL Server utility.

    Alternatively, you can partially automate the import by copying the Word table into Microsoft Excel, then exporting the data to DTS. Follow these steps:

    In Word, select a table by clicking the Table Select icon in the table's top left corner, then press Ctrl+C to copy the table.

    To convert the table into an Excel row, in Excel, paste the table into a workbook by clicking the top left cell (A1), then pressing Ctrl+V.

    To transpose the newly pasted row to a column, copy the row, tab to a new worksheet, click in the A1 cell, click the drop-down arrow on the paste icon, then select the Transpose option. The transposing action turns each row into a column.

    Select the data row, then paste it to the end of the master sheet. When all tables have the same form and structure, include the row headers only the first time you paste a row into the sheet.

    Repeat Steps 1 through 4 for each Word table.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • It would be far better to use something besides Word as your input GUI. Excel would be a better "poor man's" GUI than Word for this type of thing.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • If you must use word, you would need to write some VBA code in the word document to react to the save event of the document. Assuming your users don't move the fields around on you in the document, it would not be terribly difficult.

    Of course, unless you lock pretty much everything in the word document so the users cannot move or modify anything, you are going to find keeping track of where your information is difficult. If you lock everything else in the document, it may be much easier to just create a web page with a couple of input boxes.

  • you can try automation library to convery docx file to HTML or txt and then use RegX to parse text line by line.

    ---------------------------

    document sql server

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply