A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Import SQL Data to Word/Export Data from Word to SQL?



 
 
Thread Tools Display Modes
  #1  
Old June 24th, 2009, 12:01 PM posted to microsoft.public.sqlserver.server,microsoft.public.word.mailmerge.fields
Andrew Staley[_5_]
external usenet poster
 
Posts: 1
Default Import SQL Data to Word/Export Data from Word to SQL?

Is it possible using Microsoft Word, SQL Server to create a document
template that will import data into mail merge fields. And then if the data
in that field is changed, for that change to be written back to the SQL
database?

Thanks in advance, Andrew.

  #2  
Old June 24th, 2009, 12:06 PM posted to microsoft.public.sqlserver.server,microsoft.public.word.mailmerge.fields
Uri Dimant
external usenet poster
 
Posts: 8
Default Import SQL Data to Word/Export Data from Word to SQL?

Andrew
Hmm, I think that is a good candidate for FILESTREAM in SQL Server 2008



"Andrew Staley" wrote in message
...
Is it possible using Microsoft Word, SQL Server to create a document
template that will import data into mail merge fields. And then if the
data in that field is changed, for that change to be written back to the
SQL database?

Thanks in advance, Andrew.



  #3  
Old June 24th, 2009, 01:00 PM posted to microsoft.public.sqlserver.server,microsoft.public.word.mailmerge.fields
Linchi Shea
external usenet poster
 
Posts: 1
Default Import SQL Data to Word/Export Data from Word to SQL?

Sure, it's possible. You can access/manipulate Word programatically through
its exposed API and access/manipulate SQL Server through any number of data
access APIs (e.g. .NET SqlClient) in the same program.

Linchi

"Andrew Staley" wrote:

Is it possible using Microsoft Word, SQL Server to create a document
template that will import data into mail merge fields. And then if the data
in that field is changed, for that change to be written back to the SQL
database?

Thanks in advance, Andrew.

  #4  
Old June 24th, 2009, 04:52 PM posted to microsoft.public.sqlserver.server,microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Import SQL Data to Word/Export Data from Word to SQL?

You can connect a Word 2002/2003/2007 Mail Merge Main document to a single
SQL Server data source using either ODBC or OLE DB - OLE DB is the default,
and essential if you have Unicode type text fields. However, unless
something has changed recently
a. you will only be able to connect to a Table or View, not a Stored Proc.
(actually, you can just about connect to a Table-valued function).
b. I am pretty sure you will need to be using Integrated (Windows)
Security.

You need a .odc which you would typically create starting from New Source...
button in the Select Data Source dialog in Word.

Word has a number of limitations that Excel does not appear to have when
accessing SQL Server data - for example, Word does not honour any SQL text
you put in the .odc. If you want to specify anything other than the basic
sorts/filters you can set up in the MailMerge Edit recipients dialog box,
you'll have to use Word's OpenDataSource method to specify the query, or use
a view. You ony get to use /one/ table/view; there's no parent/child stuff
in Word MailMerge out-of-the-box Mailmerge.

Incidentally, you can also use a Word DATABASE field to insert an entire
table without using MailMerge. This has other limitations and won't help you
post updates back to SQL Server.

What I can't tell you off the top of my head is whether you will be able to
edit source data in that scenario, using MailMerge Edit Recipients. I would
expect that you can as long as the data source allows it. It doesn't (can't)
impose any validation rules of its own so you would have to rely on SQL
Server constraints etc. for that.

Another approach if you are using Word 2007 is to use Content Controls
instead of merge fields and use the related Custom XML data as an
intermediary. You get to write all the code, probably in a .NET language,
but there are ome basic MS examples around and AIUI VSTO can do some of the
plumbing for you.

Peter Jamieson

"Andrew Staley" wrote in message
...
Is it possible using Microsoft Word, SQL Server to create a document
template that will import data into mail merge fields. And then if the
data in that field is changed, for that change to be written back to the
SQL database?

Thanks in advance, Andrew.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.