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 2000 Forums
 Transact-SQL (2000)
 procedure (Microsoft SQL)

Author  Topic 

marlina
Starting Member

2 Posts

Posted - 2002-09-09 : 22:13:01
hi,
here i try to create one simple procedure that will be insert one record on 12.01 midnight every day. so the effective table must be increase one record every day. that procedure are created in my database (not in master database). my problem is i don't know how to set that procedure run automatically.


timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2002-09-09 : 22:23:14

Create a job in the SQL Server Agent that runs at that time every day. The job can contain the statement(s) you want to run at that time. Or you could write a stored procedure to write the row, then call it from the job.


Hope this helps

Tim

Go to Top of Page

marlina
Starting Member

2 Posts

Posted - 2002-09-10 : 22:23:18
my insert procedure is :


CREATE PROCEDURE [insert_STAFF_1]
(@ID_1 [int],
@NAMA_2 [varchar](50),
@STARTDATE_3 [datetime])

AS INSERT INTO [test123].[dbo].[STAFF]
( [NAMA],
[STARTDATE])

VALUES
( 'abc',
'8/12/1980')

GO

*** end procedure ***

i try to set default value in my procedure. but nothing happen in my table when i try create a job and set the action timing now. is my procedure is wrong.

Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2002-09-11 : 04:07:18
quote:

my insert procedure is :


CREATE PROCEDURE [insert_STAFF_1]
(@ID_1 [int],
@NAMA_2 [varchar](50),
@STARTDATE_3 [datetime])

AS INSERT INTO [test123].[dbo].[STAFF]
( [NAMA],
[STARTDATE])

VALUES
( 'abc',
'8/12/1980')

GO

*** end procedure ***




Surely it should be

VALUES

( @NAMA_2,
@STARTDATE_3
)


At the end?


Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2002-09-11 : 07:22:23
Does the job run?
Look at the job history.
If not make sure it is enabled and the schedule is enables.
If it does then look at the error.
If no error make sure it is calling the right SP.
If so make sure the SP works.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2002-09-14 : 09:21:24
create a job for the procedure and schedule it to run at the specified time

Go to Top of Page
   

- Advertisement -