Share via

DATABASE field code with SQL query

Anonymous
2022-08-20T20:54:15+00:00

Hi,

How can I assign {DATABASE field code with SQL query } return values to specified bookmarks

Ex: {DATABASE \c connection sting \s "Select name,surname from table_name" }

I need to assign returning values of name and surname to specified bookmarks

name_bkm = name

surname_bkm=surname

to use in multiple locations on it's word documents.

Thank you.

Microsoft 365 and Office | Word | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2022-08-21T21:12:09+00:00

    Hi George

    I am trying to get data in MS WORD from SQL SERVER and/or EXCEL files. Like mailmerge. But I don't want to use the mailmerge field code. I have 20+ Pages and 10 different Word documents that need to insert something from Excel or SQL Server Table. I know to use {DATABASE \C connection sting \s SQL query } but in this usage, the pulled data appears as something table on the word page. I am asking if is there any way to assign the pulled data to a bookmark/variable or whatever, in order to use the pulled data in different paragraphs in the same document.

    Regards

    inci tr

    Dear EED2012,

    Good day! Thanks for posting in Microsoft Community. We are happy to help you.

    According to the reference, \s "SQL" is for SQL instructions, like \s "SELECT * FROM Table1". As you mentioned “I need to assign returning values of name and surname to specified bookmarks”, may I know more details about your requirement?

    We look forward to your response. Thanks for your cooperation.

    Sincerely,

    George | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2022-08-21T20:27:50+00:00

    Dear EED2012,

    Good day! Thanks for posting in Microsoft Community. We are happy to help you.

    According to the reference, \s "SQL" is for SQL instructions, like \s "SELECT * FROM Table1". As you mentioned “I need to assign returning values of name and surname to specified bookmarks”, may I know more details about your requirement?

    We look forward to your response. Thanks for your cooperation.

    Sincerely,

    George | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments