Import contacts from SQL Server to Outlook
I'm having some trouble getting personal contacts of some users I have in a database in SQL Server 2008.
I need to import into Outlook, so I can send an email to each one.
What is the best way for me to be able to connect to the database an开发者_开发技巧d get the contacts?
Thanks.
You can easily import contacts into Outlook with a .csv
file.
- Open SQL Server Management Studio
- Connect to database
- Goto Tools > Options > Query Results > SQL Server > Results to Text
- Under Output format choose Comma Delimited
- Confirm the "Include column headers" box is checked
- Click OK
- Open a new query window
- Run your query
You should see the results as comma-delimited text. You can either copy and paste to a .csv file or re-run the query and send the results to a file (Ctrl + Shift + F)
.
For a screenshot, see this question.
I don't understand if what you need is put your SQLSERVER contacts in your OUTLOOK or the other way around.
If you need to put your SQLSERVER contacts into OUTLOOK:
- Use .NET Framework
- Connect to SQL server
- Do a query to get all the contacts you need
- Put them into Outlook using OLE
If you need to put your OUTLOOK contacts into SQLSERVER
- Use .NET Framework
- Connect to Outlook using OLE
- Get all the contacts you need
- Put them into SQLSERVER using insert sentences
If all you need is sending emails to contacts you have in an SQL Server table, you don't need to go through the hassle of importing them into Outlook.
Have a look at xp_sendmail.
It should be possible to have your mails send with a "simple" transact SQL script.
Some other links that might be usefull
- Providing the User parameter.
- Using Xp_sendmail With the Recipients Generated From a Query
精彩评论