Showing posts with label develop. Show all posts
Showing posts with label develop. Show all posts

Wednesday, March 28, 2012

Scheduling DtsBackup2000?

Dear folks,
Is it possible? Show us a instatiable model such application? I would like
to develop any which might be able to start and do the wly transferences
to disk (.dts,.dtb).
Thanks for any comment or idea,Hi Enric,
What i do is make a .cmd file that contains all the DTSBackup2000cmd.exe
command lines
I then use SQL Server Agent and scheduled a CmdExec job that executes the
.cmd file nightly
HTH. Ryan
"Enric" <Enric@.discussions.microsoft.com> wrote in message
news:D86F5040-3C86-44D9-AB08-1A2370A390F0@.microsoft.com...
> Dear folks,
> Is it possible? Show us a instatiable model such application? I would like
> to develop any which might be able to start and do the wly
> transferences
> to disk (.dts,.dtb).
> Thanks for any comment or idea,
>|||Right. Do you mind show me a few ones?
thanks
"Ryan" wrote:

> Hi Enric,
> What i do is make a .cmd file that contains all the DTSBackup2000cmd.exe
> command lines
> I then use SQL Server Agent and scheduled a CmdExec job that executes the
> ..cmd file nightly
> --
> HTH. Ryan
> "Enric" <Enric@.discussions.microsoft.com> wrote in message
> news:D86F5040-3C86-44D9-AB08-1A2370A390F0@.microsoft.com...
>
>|||Here's how...
Open Notepad paste the following in
DTSBackup2000Cmd.exe /SS (local) /SE /T /DS OffSite /DU sa /DP password
Save AS - DTSBackup.cmd
Then navigate your way to Jobs in EnterPrise Manager and schedule the
running of DTSBackup.cmd
Management\SQL Server Agent\Jobs
Right Click\New Job\Steps\New\Type\CmdExec
HTH. Ryan
"Enric" <Enric@.discussions.microsoft.com> wrote in message
news:4A0F1FA2-FB8E-4BF0-AD1C-6697D8163B24@.microsoft.com...
> Right. Do you mind show me a few ones?
> thanks
> "Ryan" wrote:
>|||Thanks a lot Ryan.
"Ryan" wrote:

> Here's how...
> Open Notepad paste the following in
> DTSBackup2000Cmd.exe /SS (local) /SE /T /DS OffSite /DU sa /DP password
> Save AS - DTSBackup.cmd
> Then navigate your way to Jobs in EnterPrise Manager and schedule the
> running of DTSBackup.cmd
> Management\SQL Server Agent\Jobs
> Right Click\New Job\Steps\New\Type\CmdExec
>
> --
> HTH. Ryan
> "Enric" <Enric@.discussions.microsoft.com> wrote in message
> news:4A0F1FA2-FB8E-4BF0-AD1C-6697D8163B24@.microsoft.com...
>
>

Monday, March 26, 2012

Scheduling Database - Design Help!

I need to develop a scheduling app and am having trouble with the
database
design. I can easily design a table hold appointments with start and
finish
times, but I always have an issue when it comes time to searching for
free
time.

The search examples:
Find the first available appointment in September
Find the first afternoon appointment
etc...

Should appointments be linked similar to a linked list? Should I create
a
row for each 5 or 10 or 15 minute slice of the day for every day and
then
just search for null in a 'used' field? This could grow way to fast.

If you need a more specific example to understand I can provide that,
but I
wanted to keep this as short as possible.

If anyone has experience designing a scheduling DB then please post
your
expoeriences.

ThanksOn 18 Sep 2005 22:20:03 -0700, Trevor.D.Matthews@.gmail.com wrote:

>I need to develop a scheduling app and am having trouble with the
>database
>design. I can easily design a table hold appointments with start and
>finish
>times, but I always have an issue when it comes time to searching for
>free
>time.
>The search examples:
>Find the first available appointment in September
>Find the first afternoon appointment
>etc...
>Should appointments be linked similar to a linked list? Should I create
>a
>row for each 5 or 10 or 15 minute slice of the day for every day and
>then
>just search for null in a 'used' field? This could grow way to fast.
>If you need a more specific example to understand I can provide that,
>but I
>wanted to keep this as short as possible.
>If anyone has experience designing a scheduling DB then please post
>your
>expoeriences.
>Thanks

Hi Trevor,

Using pre-allocated slots would bloat your database (though Daniel's
idea would limit this somewhat), and at the same time, it would limit
the freedom of the user to make appointments the way he wants to, to the
granularity of your pre-allocated slots.

Here's an alternative:
CREATE TABLE Schedule
(PersonID int NOT NULL REFERENCES (Persons),
StartTime smalldatetime NOT NULL,
EndTime smalldatetime NOT NULL, -- but see below!
-- other columns,
PRIMARY KEY (PersonID, StartTime),
UNIQUE (PersonID, EndTime),
CHECK (EndTime > StartTime),
)
You'd also need to ensure that there are no overlapping intervals, but
that can't be done in a CHECK constraint - you'll ened a trigger to
verify that business rule.

With this design, you can go two ways:

a) Store only the appointments. If there are no intervals that start
before time Y and end after time X, then the time interval from X to Y
is available for appointments.
This approach makes the processes for adding, changing and removing
appointments easy, but makes searching for available time somewhat
harder, as you have to search for absence of rows.

b) Change the nullability of EndTime to allow NULLs. NULL will represent
"eternity". Define a code to represent available time. Give each person
one special starting row: StartTime is the earliest datetime your
application will allow; EndTime is NULL; row marked as "available time".
When making the first appointment, the end time in this first row is
changed to the start time of the appointment, a row is added for the
appointment and an extra row is inserted to makr the time from the end
of the appointment to eternity (NULL) as available.
This approach makes the processes for adding, changing and removing
appointments harder (think about the combinations: an appointment in the
middle of available time has to be treated differently from an
appointment that immediately follow the previous appointment, that's
followed by another appointment, or even both. When appointments get
removed, changed, or shortened, the time that is now available again has
to be collapsed with adjacent avaialble time. Etc etc), but makes
searching for available time easier, as each time will always be part of
exactly one time slot in the Schedule table.
Note: To be complete and fail-safe, you'll also have to implement checks
(in trigger code) to ensure that there are no overlaps and no gaps
between a person's rows in the schedule).

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)|||Thanks so much to everyone for the input. I'll try out a couple of the
ideas and post back my results in case anyone wants to know how it
played out.

Thanks again,
Trevor

Trevor.D.Matthews@.gmail.com wrote:
> I need to develop a scheduling app and am having trouble with the
> database
> design. I can easily design a table hold appointments with start and
> finish
> times, but I always have an issue when it comes time to searching for
> free
> time.
> The search examples:
> Find the first available appointment in September
> Find the first afternoon appointment
> etc...
> Should appointments be linked similar to a linked list? Should I create
> a
> row for each 5 or 10 or 15 minute slice of the day for every day and
> then
> just search for null in a 'used' field? This could grow way to fast.
> If you need a more specific example to understand I can provide that,
> but I
> wanted to keep this as short as possible.
> If anyone has experience designing a scheduling DB then please post
> your
> expoeriences.
> Thanks

Scheduling a job using a stored procedure through a Stored Procedure

I currently new to SQL server and have been assigned a project to develop an auction site as part of my course. I would like to create a stored procedure which schedules a job to modify the 'auction state' field in a table to 'active' once the auction start time is reached and also run a scheduled job to close the auction at the end time.

I was thinking about using a stored procedure which calls on the sp_add_job but you have to use the msdb for this and you cannot use the 'USE' keyword inside a stored produre to call this. Am I going the wrong way about this or is it possible?EXECUTE msdb.dbo.sp_add_job-PatP|||The code snippet below has completed successfully, but i there seems to be a problem with it, can you use a local variable as a value for job name like below?

exec msdb.dbo.sp_add_job @.job_name = @.AuctionID
exec msdb.dbo.sp_add_jobstep @.job_name = @.AuctionID,
@.stepname = 'Step1',
@.command = 'Update Auction
SET AuctionState = ''closed''
WHERE AuctionID = @.AuctionID'

thanks for the earlier response.|||Can anyone see a problem with the code below, STEP1 doesn't get included when the job is scheduled. Suspected errors highlighted in red. The errors haven't been added cos they are confusing.
_______________________________________________
INSERT INTO Auction
(...

)

VALUES
(
...)

SELECT
@.AuctionID = @.@.Identity
declare @.Aid varchar
set @.Aid = convert(varchar,@.auctionID,15)
Declare @.sqlcommand varchar(255)
Set @.sqlcommand = 'UPDATE Auction SET AuctionState = ''closed'' WHERE AuctionID = ' + @.AID

exec msdb.dbo.sp_add_job @.job_name = @.AUCTIONID
exec msdb.dbo.sp_add_jobstep @.job_name = '@.AUCTIONID',
@.step_name = 'Step1',
@.command = @.sqlcommand,
@.database_name = 'Auction',
@.server = 'XX'
exec msdb.dbo.sp_add_jobschedule @.job_name = @.AuctionID,
@.name = 'AuctionsScheduled',
@.freq_type = 1,
@.active_start_time ='120000',
@.active_start_date = '20040703',
@.freq_recurrence_factor = 1
exec msdb.dbo.sp_add_jobserver @.job_name = @.auctionID,
@.server_name = 'XX'

_____________________________________________