Showing posts with label everyday. Show all posts
Showing posts with label everyday. Show all posts

Tuesday, March 27, 2012

Automating Daily Database Inserts.

Hi can anybody please provide me information on how i can automate a vb.net script to insert records in to a SQL Server database everyday. I know that the Scheduled Tasks tool in Control Panel must be used but i am not sure about the VB.net code. Opening up the DB and inserting records is no problem its just geting the script to run using the Scheduled Tasks tool. Any other type of script that opens up a DB or updates it even a vb.net script that executes using the Scheduled Tasks tool would be helpful.

Thanks in advance for the help.

ImranDoes it have to be run via DotNet? It would be simpler if you could have the Sql Server Agent run some SQL or execute a sproc. Alternatively you could have DTS do it and Sql Server Agent would trigger the DTS package.

If you need to create the scheudle from DotNet you would need to create a Service that manages when things run and then at the appropriate time trigger your code. If you need to go this route I can post some code to get you started but it will be in C# so you'll have to translate.|||The service is the best idea.

Simply, yet very bad and chessy, but effective, is to build an aspx page that performs the work, and place the following command in a batch file:


"C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://MyScriptURL"

You could then use the built in Scheduler (AT.exe from a command prompt) within 2000 or NT4, or any other scheduler, to run the batch file nightly.

Of course, the great risk here is anyone can fire that URL at anytime and then it runs more than once. If it's a critical, must be bullet-proof task, go with the service. If you want something quick and dirty, that's temporary, give the above a shot.

Brian|||McMurdoStation

i was going to post a question in the forum about this and i saw this thread.
can you give some advice on how to get started...link to some tutorial, i am writing a vb.net app tht will call some SP's ( the Sp's will add transactions to customer transactions table). i need to create an html file (i can already do this). basically i have the whole prog working. i can run it manually. i just need to schedule it so it runs automatically every night ( at the specified time).

thanks.|||This article should get you started for creating a DotNet scheduler service.|||Hi McMurdoStation,
yes could you post the code please.

Thanks for the help.|||Hi Brian,
is the command that you specified above the only command that needs to go in to the batch file or do some other commands need to be put in there. In other words do i need to create a file called for example updatedb.bat and put the following bit of code in to it in the following way.


C:\Program Files\Internet Explorer\IEXPLORE.EXE http://localhost/metrics/updatedb.aspx

or do some other bits of code need to go in there aswell? Thanks for your help its much appreciated.|||All you should need is the above one line of code. You can test it by running it from a cmd prompt yourself. All it does is fire IE with the address that follows, and of course, the page renders.

If you can schedule that command, w/o having to use a batch file, then that will work as well. It's just nice to keep the comand in a batch file so it can be updated w/o having to touch a scheduler.

I, again, do recommend the service. My idea is just a temp or short-term workaround.

Brian|||ASPNester,

The link posted above describes how to create a scheduler service with VB.Net. It's probably easier to work from that rather than try to translate my C# code.|||thanks McMurdoStation...will spend some tiem trying to go through the article and understanding it.
thanks.|||Brian thanks, the code worked.

However as you mention its not really an ideal method. Do you know of any web sites that have tutorials for creating "Windows?" Service, or any books that have instructions on creating window services, the URL that McDurmock gave uses Visual Studio so its not really much use for me.

Thanks for all you r help anyway.|||Wrox has a good book called "Visual Basic .NET Windows Services Handbook". It's just under 200 pages, and meant to get you going fast. However, it assumes you have VS.NET. Of course, you don't need VS.NET. It shows most code, so you should be able to get by.

I've only written one service, but was up to speed in just a few days with the book

ISBN 1-86100-772-8, ~$30.

Brian|||ok mate thanks for all your help.

Tuesday, March 20, 2012

automatic script with SQL Server 2000

Hello,
Newbie question:
How can you set a SQL Server 2000 script which will launch automaticly every
day ?
Thanks for your help!One way would be to create a SQL Server JOB, and designate the time to
execute. (That 'JOB' could be running a Stored Procedure -for example.)
Arnie Rowland*
"To be successful, your heart must accompany your knowledge."
"Newbie" <newbie@.beginers.com> wrote in message
news:Of6IaxGpGHA.3600@.TK2MSFTNGP04.phx.gbl...
> Hello,
> Newbie question:
> How can you set a SQL Server 2000 script which will launch automaticly
> every
> day ?
> Thanks for your help!
>
>|||Thanks Arnie,
The script is alredy written. How can I create the job which'll launch it ?
(NB : I'm a very beginner;-)
Thanks again
"Arnie Rowland" <arnie@.1568.com> a crit dans le message de
news:udsgS%23GpGHA.3324@.TK2MSFTNGP05.phx.gbl...
> One way would be to create a SQL Server JOB, and designate the time to
> execute. (That 'JOB' could be running a Stored Procedure -for example.)
> --
> Arnie Rowland*
> "To be successful, your heart must accompany your knowledge."
>
> "Newbie" <newbie@.beginers.com> wrote in message
> news:Of6IaxGpGHA.3600@.TK2MSFTNGP04.phx.gbl...
>|||In Enterprise Mangler, expand down through your server until you get to SQL
Server Agent, and then Jobs.
Right click on the right pane, and select 'New Job'. Most of the rest will
be reasonably explanitory. You can look up SQL Agent Jobs in Books on Line.
Arnie Rowland*
"To be successful, your heart must accompany your knowledge."
"Newbie" <newbie@.beginers.com> wrote in message
news:Oyd1ZGHpGHA.4188@.TK2MSFTNGP03.phx.gbl...
> Thanks Arnie,
> The script is alredy written. How can I create the job which'll launch it
> ?
> (NB : I'm a very beginner;-)
> Thanks again
> "Arnie Rowland" <arnie@.1568.com> a crit dans le message de
> news:udsgS%23GpGHA.3324@.TK2MSFTNGP05.phx.gbl...
>|||Thanks a lot Arnie !
That's great !
Newbie
"Arnie Rowland" <arnie@.1568.com> a crit dans le message de
news:%23NBhNaHpGHA.3564@.TK2MSFTNGP03.phx.gbl...
> In Enterprise Mangler, expand down through your server until you get to
SQL
> Server Agent, and then Jobs.
> Right click on the right pane, and select 'New Job'. Most of the rest will
> be reasonably explanitory. You can look up SQL Agent Jobs in Books on
Line.
>
> --
> Arnie Rowland*
> "To be successful, your heart must accompany your knowledge."
>
> "Newbie" <newbie@.beginers.com> wrote in message
> news:Oyd1ZGHpGHA.4188@.TK2MSFTNGP03.phx.gbl...
it[vbcol=seagreen]
automaticly[vbcol=seagreen]
>|||Arnie,
In the Command section of the New job Step, how I said to launch the
ScriptXX ?
"Arnie Rowland" <arnie@.1568.com> a crit dans le message de
news:%23NBhNaHpGHA.3564@.TK2MSFTNGP03.phx.gbl...
> In Enterprise Mangler, expand down through your server until you get to
SQL
> Server Agent, and then Jobs.
> Right click on the right pane, and select 'New Job'. Most of the rest will
> be reasonably explanitory. You can look up SQL Agent Jobs in Books on
Line.
>
> --
> Arnie Rowland*
> "To be successful, your heart must accompany your knowledge."
>
> "Newbie" <newbie@.beginers.com> wrote in message
> news:Oyd1ZGHpGHA.4188@.TK2MSFTNGP03.phx.gbl...
it[vbcol=seagreen]
automaticly[vbcol=seagreen]
>|||You can just copy and paste the script into the window.
Arnie Rowland*
"To be successful, your heart must accompany your knowledge."
"Newbie" <newbie@.beginers.com> wrote in message
news:ONmdioHpGHA.1140@.TK2MSFTNGP05.phx.gbl...
> Arnie,
> In the Command section of the New job Step, how I said to launch the
> ScriptXX ?
> "Arnie Rowland" <arnie@.1568.com> a crit dans le message de
> news:%23NBhNaHpGHA.3564@.TK2MSFTNGP03.phx.gbl...
> SQL
> Line.
> it
> automaticly
>|||Arnie,
Thanks a lot !
"Arnie Rowland" <arnie@.1568.com> a crit dans le message de
news:Oz9bVGJpGHA.756@.TK2MSFTNGP05.phx.gbl...
> You can just copy and paste the script into the window.
> --
> Arnie Rowland*
> "To be successful, your heart must accompany your knowledge."
>
> "Newbie" <newbie@.beginers.com> wrote in message
> news:ONmdioHpGHA.1140@.TK2MSFTNGP05.phx.gbl...
launch[vbcol=seagreen]
to[vbcol=seagreen]
>

Friday, February 10, 2012

Auto Import into sql from a Tab Delmited flat file

i was wondering if there was a way to auto import my file everyday and then process the deminsions and cube i have made in the analysis service program

I suggest looking at the integration services feature in SQL 2005 and DTS in SQL 2000.

You could also use BCP or Bulk Insert.

All of these are covered in books online.

Auto generating an email

Hi All,

I need to opening up a browser page everyday at 6am. (What I am trying to do is to send an email with some formatted output everyday at 6am)

Is there anyway to achive this via SQL 05 Express?

Thanks,

Mal.

Hi,

why would you need to open a webpage every day? SQL Server's capable of sending emails itself. Another option is to create a console application that can send the mails and have it scheduled with windows task schedular to run at 6am every day.

http://support.microsoft.com/kb/312839/en-us

Grz, Kris.

|||

Hi,

The reason I'd like to open up a web page is because, the template of the data is already there. With little bit of improvisation I would get it to be sending an email.

Actually, I did know (didn't know the code) it is possible to send emails from SQL 2K but not 05 Express.

My intension now is to open up the web page with a process and later kill the process. (with the help of schedular). It is not the best methods around as far as I can see, but hopefully I would be able to implement that quickly.

Thanks for the tip and the link.

Mal.

|||

Hi,

suhash:

My intension now is to open up the web page with a process and later kill the process. (with the help of schedular). It is not the best methods around as far as I can see, but hopefully I would be able to implement that quickly.

create a console application and use theHttpServerUtility.Execute method to execute the webform and capture the rendered html. No need to open a browser etc.

Grz, Kris.

|||

Oh, thanks a lot.

I was thinking to open up a page...

Problem solves thanks to you again,

Cheers.