Reply
 
Thread Tools Display Modes
  #1   Report Post  
Bod
 
Posts: n/a
Default Mailmerging data from SQL Server tables

I am using a SQL Server View (combining fields from 3 tables) as the data
source for a Mailmerge. If a field is defined as nvarchar in the SQL table
it does not appear in the merged document, but if the definition is changed
to varchar it merges correctly. Why is this?

Also a field defined as datetime in the SQL table refuses to accept format
switches -

{MERGEFIELD Tx_Date \@ "dd/mm/yyyy"}
{MERGEFIELD Tx_Date \@ "yyyy.mm.dd"} etc...

Always appears in the document as

04/12/2004 00:00:00

Why is this?

(I'm using Office XP (Word 2002) and SQL Server 2000 if that matters)

Cheers
  #2   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?B?Qm9k?=,

From the sound of it, you're connecting to SQL using ODBC rather than OLE DB?
Have you tried OLE DB?

The SQL ODBC driver + Word mail merge does not recognize unicode (nvarchar).
And there are also problems with date formats.

If you want to continue to connect in this way, include the date formatting
and field type conversion as part of the View definition.

I am using a SQL Server View (combining fields from 3 tables) as the data
source for a Mailmerge. If a field is defined as nvarchar in the SQL table
it does not appear in the merged document, but if the definition is changed
to varchar it merges correctly. Why is this?

Also a field defined as datetime in the SQL table refuses to accept format
switches -

{MERGEFIELD Tx_Date \@ "dd/mm/yyyy"}
{MERGEFIELD Tx_Date \@ "yyyy.mm.dd"} etc...

Always appears in the document as

04/12/2004 00:00:00

Why is this?

(I'm using Office XP (Word 2002) and SQL Server 2000 if that matters)


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

  #3   Report Post  
Bod
 
Posts: n/a
Default

Hi Cindy,

Yes, I am using ODBC to connect as it is the only method I ever learned how
to use, but that seems to explain my problem. Thank you. Perhaps I should
try OLE DB if that is better.

The date problem became quite bizarre as I explored further. I set any
missing dates in the SQL table to 01/01/1900 (to identify them as missing)
and it was this date the Mailmerge did not like. In fact it is any date in
the year 1900! If I set the date to 01/01/1901 or later it formats and
displays correctly.

Thanks again, Bod

"Cindy M -WordMVP-" wrote:

Hi ?B?Qm9k?=,

From the sound of it, you're connecting to SQL using ODBC rather than OLE DB?
Have you tried OLE DB?

The SQL ODBC driver + Word mail merge does not recognize unicode (nvarchar).
And there are also problems with date formats.

If you want to continue to connect in this way, include the date formatting
and field type conversion as part of the View definition.

I am using a SQL Server View (combining fields from 3 tables) as the data
source for a Mailmerge. If a field is defined as nvarchar in the SQL table
it does not appear in the merged document, but if the definition is changed
to varchar it merges correctly. Why is this?

Also a field defined as datetime in the SQL table refuses to accept format
switches -

{MERGEFIELD Tx_Date \@ "dd/mm/yyyy"}
{MERGEFIELD Tx_Date \@ "yyyy.mm.dd"} etc...

Always appears in the document as

04/12/2004 00:00:00

Why is this?

(I'm using Office XP (Word 2002) and SQL Server 2000 if that matters)


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
When joining tables, table sections shift left or right. JEB01 Tables 1 January 17th 05 08:57 PM
Merge data into one document from several tables in Access. Professor Wise Mailmerge 1 December 2nd 04 11:40 PM
How do you merge two Access databases into one set of tables Charles, UVA Health System Microsoft Word Help 0 December 2nd 04 10:25 PM
Linking Excel data to tables in Word KSit Tables 3 November 26th 04 10:36 PM
Merge Data Source path Peter Jamieson Mailmerge 0 November 25th 04 08:15 PM


All times are GMT +1. The time now is 12:49 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"