Showing posts with label email. Show all posts
Showing posts with label email. Show all posts

Monday, March 19, 2012

Create Procedure: SQL Server 2005

Hi everyone,

I'm creating a online e-letter registration system. That saves 'temp' values to a 'temp' table, and then sends a automated email to the subscriber, from which he/she can then except, or decline the registration.

bu now i want to create a procedure, or some kind of funciton in T-SQL that will be scheduled to run every 2 or so hours, to check and see if there is any values in the temp table that is older than 24hours, and if that values is greater than 24hours, it must delete that values from the temp table... so that the temp table doesn't become too full of old, outdated data.

Please help.

Thanks

OK, thats an easy thing, but we need more input to see what you will have to do. Which SQL Server are you using ? The delete part would be the easiest, as it would turn out to be something like

DELETE FROM SomeTable Where DATEDIFF(dd,SomeDatecolumn,GETDATE()) >= 1

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||what do you mean, "what SQL server am I using?" SQl Server 2005....|||OK, it would be interesting to know which SKU you are using (in detail if you use Express or not) because with any other edition than Express you would be able to use the SQL Server agent as well to plan the execution of your procedure. You will not need to create a stored procedure as the statement above will run fine using a simple job step with an TSQL execution element. Once the job step is created you will just have to schedule the execution of the job and you are done.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||no, this is not SQL Server Express, It can be either the Developer Edition, or the Enteprise Edition...|||Then go straight ahead by creating a job, defining a schedule and inserting one step for executing the TSQL statement mentioned above.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

Saturday, February 25, 2012

Create linked exchange server

I'm using sql server 2005 and exchange 2003. End result is I want to upload email attachments to a table in sql. No one seems to have any idea how do do this except with .net, which i know nothing about so not really an option for me. I found this bit of info with some extensive web searching. Can anyone help fill in the blanks? I can't get the linked server to work yet.

EXEC sp_addlinkedserver 'exchange',
'Exchange OLE DB provider',
'exoledb.DataSource.1',
'file:\\.\backofficestorage\mailservername\public folders'

Error received:The OLE DB provider "exoledb.DataSource.1" has not been registered.

Does the Exchange Ole DB Driver exist on the SQL Server machine? I am assuming the 2 services are not on the same machine. If not, you may need to install the Exchange SDK or management tools on the SQL Server to get the OleDB driver installed.

Create linked exchange server

I'm using sql server 2005 and exchange 2003. End result is I want to upload email attachments to a table in sql. No one seems to have any idea how do do this except with .net, which i know nothing about so not really an option for me. I found this bit of info with some extensive web searching. Can anyone help fill in the blanks? I can't get the linked server to work yet.

EXEC sp_addlinkedserver 'exchange',
'Exchange OLE DB provider',
'exoledb.DataSource.1',
'file:\\.\backofficestorage\mailservername\public folders'

Error received:The OLE DB provider "exoledb.DataSource.1" has not been registered.

Does the Exchange Ole DB Driver exist on the SQL Server machine? I am assuming the 2 services are not on the same machine. If not, you may need to install the Exchange SDK or management tools on the SQL Server to get the OleDB driver installed.