Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Sql services

Author  Topic 

gurusamy.senthil
Yak Posting Veteran

65 Posts

Posted - 2007-01-22 : 06:00:56
Hello Everyone,

I developed my custom screens in VB which is a process screen will automatically read the values based on some condition and insert or update the values in to the table. MY client do not want to start the process using the VB screen, instead they need the program to run automaically from the sql server with the interval of 1 or 2 hrs.

Please advice how to do the above using sql services.


Thanks,
Senthil .G

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-22 : 06:02:09
Rewrite the VB program as an NT service and have it run for every 2 hours.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-01-22 : 06:03:39
why not create a stored procedure to perform the same function ?


KH

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-22 : 06:06:11
quote:
Originally posted by khtan

why not create a stored procedure to perform the same function ?
Way too easy


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

gurusamy.senthil
Yak Posting Veteran

65 Posts

Posted - 2007-01-22 : 06:08:59
Khtan,

If I written the code in Stored procedures how will you call in Sql. I am not going to use the VB code to call the sp. Instead I am going to process the same as what the VB screen doing. Can I run the process automatically for every one or two hrs?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-01-22 : 06:09:26
Sorry . . what was i thinking


KH

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-22 : 06:11:34
quote:
Originally posted by gurusamy.senthil

If I written the code in Stored procedures how will you call in Sql.
You simply create a JOB that runs every 2 hours and calls the stored procedure you have written earlier.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

gurusamy.senthil
Yak Posting Veteran

65 Posts

Posted - 2007-01-22 : 06:12:48
Like windows and web service, Can we write sql service in Sql server?
Tell me how to create and write the Sql services.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-22 : 06:14:44
I give up.
Use Google and do a thorough search...


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

gurusamy.senthil
Yak Posting Veteran

65 Posts

Posted - 2007-01-22 : 06:15:07
I think that will work but tell me after creating the job how to implement the Job in clint side. Am I have to follow any instruction to start the job in client side?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-22 : 06:18:28
The job is ON the server, no client side involved.
You simply schedule the job to run with an interval of your choice.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-01-22 : 06:19:11
Jobs are meant to be run at Server side not client side.

1. You can use SQL Server jobs in case your task is entirely based on the SQL
2. you can create Windows Service application in case of VB.Net or C#.net and then schedule the service
3. In case you are using VB 6.0, you can create application and schedule it to run at specific interval using Windows Task Scheduler.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-22 : 06:22:24
3.5) It is possible to write NT Services with VB 6.0 with the help of the activex control ntsvc.ocx


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-01-22 : 06:25:04
quote:
Originally posted by Peso

3.5) It is possible to write NT Services with VB 6.0 with the help of the activex control ntsvc.ocx


Peter Larsson
Helsingborg, Sweden



Is it? I was not aware of it.

Thanks Peter for the information!

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-22 : 06:28:11
Yes, it work great too!
It is a free download from Microsoft as well.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

gurusamy.senthil
Yak Posting Veteran

65 Posts

Posted - 2007-01-22 : 13:00:26
Thanks for everyone for your replies.

I have tried to create the Job in Sql server with the help of one site but it fails and result many errors.

Can anyone start my engine of how to proceed and write a Job in Sql server 2000 or any links which you perfers.

Please advice.

Thanks,
Senthil .G
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-22 : 13:02:41
For jobs to work, you must have SQL Server Agent running.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

gurusamy.senthil
Yak Posting Veteran

65 Posts

Posted - 2007-01-23 : 01:15:57
I am question. Can I have my stored procedure inside the Job or I have to give sentence like exec <stored procedure>. Which method is correct?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-01-23 : 01:18:39
you create a job and in the script

exec <stored procedure>


KH

Go to Top of Page

gurusamy.senthil
Yak Posting Veteran

65 Posts

Posted - 2007-01-23 : 01:44:25
Thanks khtan that works fine.

In this Transact-Sql I also posted another question of File print in sql server. Please take a look and advice me.
Go to Top of Page

gurusamy.senthil
Yak Posting Veteran

65 Posts

Posted - 2007-01-23 : 08:29:49
Consider an employee table and for some employee salary should be zero. Now I am want to write a sp and then the employee whose salary is zero been moved to log file. So using a Sql service can I print a record in text files.
Go to Top of Page
    Next Page

- Advertisement -