Database Design For Schedule Task

Apr 13, 2008

Hi there

I am trying to copy what is happing in "Schedule Task" on Windows and put into database design below. It's a denormalisation though.

What is the better way to handle this schenario such as DAILY, WEEKLY AND MONTHLY TASK? I did try put into normalisation by adding extra table called ScheduleDetail which holds DAYS and MONTHLY but it's more complicated.

Anyway .. I am waiting your comment or anything.


CREATE TABLE [dbo].[glb_Schedules](
[ScheduleID] [bigint] IDENTITY(1,1) NOT NULL,
[ScheduleGroupID] [bigint] NULL,
[ScheduleTypeID] [int] NULL,
[StartTime] [smalldatetime] NULL,
[EndTime] [smalldatetime] NULL,
[Length] [int] NULL,
[IsMonday] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsMonday] DEFAULT ((0)),
[IsTuesday] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsTuesday] DEFAULT ((0)),
[IsWednesday] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsWednesday] DEFAULT ((0)),
[IsThursday] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsThursday] DEFAULT ((0)),
[IsFirday] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsFirday] DEFAULT ((0)),
[IsSaturday] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsSaturday] DEFAULT ((0)),
[IsSunday] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsSunday] DEFAULT ((0)),
[IsJanuary] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsJanuary] DEFAULT ((0)),
[IsFebruary] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsFebruary] DEFAULT ((0)),
[IsMarch] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsMarch] DEFAULT ((0)),
[IsApril] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsApril] DEFAULT ((0)),
[IsMay] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsMay] DEFAULT ((0)),
[IsJune] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsJune] DEFAULT ((0)),
[IsJuly] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsJuly] DEFAULT ((0)),
[IsAugust] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsAugust] DEFAULT ((0)),
[IsSeptember] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsSeptember] DEFAULT ((0)),
[IsOctober] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsOctober] DEFAULT ((0)),
[IsNovember] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsNovember] DEFAULT ((0)),
[IsDecember] [bit] NULL CONSTRAINT [DF_glb_Schedules_IsDecember] DEFAULT ((0)),
[DateCreated] [datetime] NULL CONSTRAINT [DF_GLB_ScheduleDetails_DateCreated] DEFAULT (getdate()),
[LastDateModified] [datetime] NULL CONSTRAINT [DF_GLB_ScheduleDetails_LastDateModified] DEFAULT (getdate()),
[IsActive] [bit] NULL CONSTRAINT [DF_GLB_ScheduleDetails_IsActive] DEFAULT ((1)),
CONSTRAINT [PK_GLB_ScheduleDetails] PRIMARY KEY CLUSTERED
(
[ScheduleID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

View 4 Replies


ADVERTISEMENT

Database Backup On Task Schedule Every 1 Hour

Sep 24, 2013

I want to take a sql server 2005 database backup on task schedule every 1 hour is that possible.

View 1 Replies View Related

Schedule Task

Feb 2, 2000

is it posible to change a file name usinging schedule task??
I used this syntax
Exec xp_cmdshell "REN
E:Elsie_DB_db_dump*.* E:Elsie_DB"

Is there another way of doing it??

View 3 Replies View Related

Schedule Task In Sql?

Apr 20, 1999

Does anyone know of any way to schedule a task using only transact sql, or is using Enterprise Mgr the only way to do this?

View 1 Replies View Related

Schedule The Task

Sep 21, 2006

I want to schedule the task using contro panel schedule task item.

I want to run two package in sequence. If the execution of one gets over then other should start.

I have configured the execution detail in BAT file.

I know how to schedule the task. But can anyone please suggest me how to schedule the task in sqeuence i.e. execution of BAT file in sequenece (one after other).

View 4 Replies View Related

Schedule Task Not Stopping

Jan 16, 2001

I've been running SQL Server for 5 years now and have not seen the following.

We have a scheduled night run task where we do various maintenance functions as well as print out the issued insurance policies for the day. All indications are that the run completed except that I did not get an email notification of success or failure.

When I went to enterprise manager, under jobs the night run seems to be stuck in the mode of "Performing completion actions". I cannot get it our of this mode back to "Not running". Trying to stop the task has no effect.

Any ideas/suggestions??

Thanks in advance.

Cheers,
Mike Byrd
Information Systems Manager
Texas Windstorm Insurance Association
Austin, Texas

View 6 Replies View Related

Schedule Task Problem

Jan 15, 1999

Hi All, I am using SQL Server 6.5 for our database server. We will run couple schedule tasks in the SQL Server everyday.
One of the task that will call a BATCH file in C:. In this batch file, it will copy some files, and zip then. Then It iwll launch
the Internet Explorer, and run a ASP program. In the ASP program, it will send out a E-Mail and then close the browser. It
works fine until this Monday. The "Schedule Task" runs on time, and do the "copy" & "zip". But it will not launch the IE,
stuck on there. I check the IE that is launched but it runs in the background. The ASP program is not running too. I used the
"notepad" instead of the IE. The result is that the batch file runs, and the "Schedule Task" will finish. But the "notepad" didn't launch.
If I just "double click" the batch file, it runs fine. So the problem is between the SQL server "Schedule Task" and the WINDOWS NT, I guess.
Has any one has a clue, please tell me. Thanks.

View 1 Replies View Related

Schedule Task Failure In SQL 6.5

Mar 12, 2001

I am having a problem with the scheduled task I am running. There had been an error message 5702 which says "The SQL Server is terminating this process". I don't understand what this means. And if I try to force the job to run, it says that the SQLExecutive service is not running on the particular server. And this prevents the task from being run. But when I try to check for the said service, it is running. I don't know what is happening here. Please help me.

View 1 Replies View Related

How To Schedule A Task In Vista

Oct 20, 2006

Hi All,

Is Vista get rid of the task scheduling? We can schedule a task easily through the Scheduled Task under control panel, but I cannot find similar stuff in Vista.

Can anyone tell me if schedule a task is still available in Vista? If yes, where can I do that?

Thakns in advance!

Gordon





View 3 Replies View Related

Urgent Help Needed Regarding Schedule Task

Dec 22, 1998

Hi every one,

I have a stored procedure which activates a task when ever that sp is called.
and this procedure gets out of the loop.

the task get started running.

Is there any way in Sql server that the same stored procedures should wait until the Task finishes and return a code either 1 or 0 for success or faliure of the task.

Help is greatly appericated
Jeswnath

View 1 Replies View Related

Encrypt/hide Paasword In Task Schedule Under EM?

Mar 8, 2000

Hello:

I am running an application on mssql 6.5, sp 4 on NT 4.0.

We routinely chnage paswords for the sa login. One loophole for users to
learn the sa password is in scheduler tasks underr EM when a task is
added to run under cmdexec, the password is written in text under the -P
paramater.


1) Is there any way to encrypt the password there or does any one have a
stored procedure or function to do s?

1) Which executible, if any, runs the scheduled tasks under EM? Is this
part of EM or is there any specific executible that runs the scheduled
tasks?

Any information oyu can provide or suggestions you cna make will be
appreciated.

Thanks

David Spaisman

View 1 Replies View Related

DB Engine :: Creating A Schedule Task To Execute After 5 Days From The 28th Of Every Month

Jun 7, 2015

Is it possible to create a SQL schedule task to execute after 5days from the 28th of every month.

View 3 Replies View Related

DB Design :: Database Design For Matrix Representation

May 13, 2015

I have a scenario like below

Product1
Product2 Product3
Product4 Product5
Product1 1
1 0 0
1
Product2 1
1 0 0
1
Product3 0
0 1 1
0
Product4 0
0 1 1
0
Product5 1
1 0 0
1

How to design tables in SQL Server for the above.

View 2 Replies View Related

Need Help For Design Data Flow Task

Nov 14, 2007

Hi frns,

I am new to SSIS. I need some help in designing the below dataflow task.


-- Teacher creates several tasks and each task is assigned to multiple students
-- The teacher table contains contains all the tasks created a every teacher
use ods
go
create table teacher
(
yr int,
tid int,
tname varchar(20),
taskid int

)

insert into teacher values(2007,101,'suraj','task1')
insert into teacher values(2007,101,'suraj','task2')
insert into teacher values(2007,102,'bharat','task3')

insert into teacher values(2007,103,'paul','task4')
insert into teacher values(2007,103,'paul','task5')
insert into teacher values(2007,103,'paul','task6')


-- Teacher "suraj" has created 2 tasks
-- Teacher "bharat" has created 1 task

select * from ods..teacher
yr tid tname taskid
============================
2007 101 suraj 1111
2007 101 suraj 1122
2007 102 bharat 2222

-- Students table contains studentid(sid),teacherid(i,e tid ) & taskid
drop table students

create table students
(
yr int,
sid varchar(10),
tid int,
taskid varchar(10)
)

truncate table students

insert into students values(2007,'stud1',101,'task1')
insert into students values(2007,'stud1',101,'task2')

insert into students values(2007,'stud2',101,'task1')
insert into students values(2007,'stud2',101,'task2')

--Note : stud1,stud2 comes under teacher with tid "101"



insert into students values(2007,'stud3',102,'task3')

-- Note : stud3 and stud4 comes under teacher with tid "102"

insert into students values(2007,'stud4',103,'task4')
insert into students values(2007,'stud4',103,'task5')
insert into students values(2007,'stud4',103,'task6')

insert into students values(2007,'stud5',103,'task4')

select * from students
yr sid tid taskid
----------------------------
2007 stud1 101 task1
2007 stud1 101 task2

2007 stud2 101 task1
2007 stud2 101 task2

2007 stud3 102 task3
2007 stud4 103 task4
2007 stud4 103 task5
2007 stud4 103 task6
2007 stud5 103 task4


Now in my target table i need to load the data in a such a way that

use targetdb
go
drop table trg
go

create table trg
(
yr int, -- data should load from teacher.yr
tid int,
taskid int(20),
cnt int

)

Mapping in target column and value to be loaded
==================================================
yr -- teacher.yr
tid -- teacher.id
taskid -- this need to start a new sequence of numbers starting from 1 for each teacher and dont want the task id to be copied as it is.
cntofstudents -- need to count no of students from "students" table for a given teacher and for his assignment

For example for teacherid "101" and taskid "task1" there are 2 students
again for the same teacher "101" and taskid "task2" there are 2 students


For teacher "102" and taskid "task3" there is only 1 student

Similary for teacher "103"


Relation
========

Teacher table | Students Table
yr | yr
tid | tid


After i run the ETL the data should look as follows :

insert into trg values(2007,101,1,2)
insert into trg values(2007,101,2,2)

insert into trg values(2007,102,1,1)

insert into trg values(2007,103,1,2) -- task4 is created by teacher "103" and assigned to 2 students stud4 and stud5
insert into trg values(2007,103,2,1) -- task5 is created by teacher "103" and assigned to 1 student i.e stud4
insert into trg values(2007,103,3,1) -- task6 is created by teacher "103" and assigned to 1 student i.e stud5

Note : If u observer the values in 3rd column of the trg table, instead of directly mapping the taskid we need to generate a separate sequence for every teacher.

BottomLine : for each and every task created by each teacher there should be a unique record along with the count of students in "STUDENTS" table


Can anyone help me out in designing the Data Flow task for this Functionality.



Thanks,
Manu

View 10 Replies View Related

Database Design/query Design

Feb 13, 2002

Ok, I'm doing a football database for fixtures and stuff. The problem I am having is that in a fixture, there is both a home, and an away team. The tables as a result are something like this:

-------
Fixture
-------
fix_id
fix_date
fix_played

----
Team
----
tem_id
tem_name

-----------
TeamFixture
-----------
fix_id
tem_id
homeorawayteam
goals

It's not exactly like that, but you get the point. The question is, can I do a fixture query which results in one record per fixture, showing both teams details. The first in a hometeam field and the second in an away team field.

Fixture contains the details about the fixture like date and fixture id and has it been played

Team contains team info like team id, name, associated graphic

TeamFixture is the table which links the fixture to it's home and away team.

TeamFixture exists to prevent a many to many type relationship.

Make sense? Sorry if this turns out to be really easy, just can't get my head around it at the mo!

View 2 Replies View Related

SSIS Task Or Design Considerations For Copying/updating/replicating Tables From One Server To Another

Dec 13, 2007




I need to copy all the data from all the tables in a database to a copy of this database on another server.
What feature of SSIS should I take advantage of to accomplish this?

We have an SLA for 8am, most times the data warehousing jobs complete at 8:05am. Adding an additional process/set of tasks to this package would obviously make matters so I'm trying to update/copy/replicate the data in the fastest manner. Typically we're talking 2 marts (10-20GB) with 2 large tables (5-10 mill records) and 20 marts (0.5 - 5 GB) with many more smaller tables (~40 tables with record count ranging from 1 to a million)

Additionally please indicate if the design/feature you suggest can handle (pushing schema changes and additions to the target server) schema changes or new tablesviews added to the source database.

My only idea so far...is using the import wizard (in Management Studio) to create an SSIS package (top copy all the tables from one server to another) and saving it to the server, Then executing this package after the job is complete. However this would not work if the schema of a table changed, or if a a table is added. Moreover I don't think I can edit this package in visual studio.

View 3 Replies View Related

Shrink Database Base On Specific Schedule

Jun 9, 2004

Hi

I want to know what is command that i add to the Query Analyzer until
i tell to the database that it Shrink my DB every 1 day

I know it can be done from all Tasks > Shrink Database ..

But i want to know the Code commands for that for using in Query Analyzer


Thanks

View 5 Replies View Related

How Can I Schedule Backup Of Whole Database Annually Without Using Replication?

Sep 20, 2001

Hi,
Is there any method that I can use to backup the whole database to another database without using replication? I have to backup it every half year. Can I do something like setting schedule to run to "Database Backup" module in sql server?


Thanks,
Matt

View 1 Replies View Related

Shrink Database Base On Specific Schedule

Jun 9, 2004

Hi

I want to know what is command that i add to the Query Analyzer until
i tell to the database that it Shrink my DB every 1 day

I know it can be done from all Tasks > Shrink Database ..

But i want to know the Code commands for that for using in Query Analyzer


Thanks

View 4 Replies View Related

How To Schedule A Database Backup In SQL Server Agent Jobs?

Jan 7, 2008

I want to schedule a database backup using SQL Server Agent Jobs how can i do this?

View 1 Replies View Related

Schedule Backup Of Specific Database While Only Saving The Last 7 Days In Repository

Apr 15, 2008



Hello to all members.
I am using SQL Server 2005 std edition 32 bit
The database is configured in compatibility mode to sql server 2000
The backup mode for the database is configured as simple

With SQL Server Agent I am running schedule task of the backup script

The question is:

I would like to save only the last 7 days in repository.
This means that when the 8th days has become then the 1st day backup is deleted.
in the 9th day the 2nd day backup file is deleted.
and so on

I am using the the T-SQL BACKUP DATABASE command with the following arguments:
RETAINDAYS = 7
NOFORMAT
NOINIT
SKIP

I am in situation that the command above only append to the backup file and without deleting the expired backup days.

What I need to change in the parameters that the script will delete the expired backup days.

Thanking in advance everyone who assist.

View 1 Replies View Related

Schedule Database Backup And Delete For Server Express 2014

Jul 30, 2015

I would like to auto daily back up for all databases on a SQL Server Express 2014, and keep back up of last 30 days.

View 3 Replies View Related

Schedule Backup Of Specific Database While Only Saving The Last 7 Days In Repository

Apr 19, 2008



Hello to all members.
I am using SQL Server 2005 std edition 32 bit
The database is configured in compatibility mode to sql server 2000
The backup mode for the database is configured as simple

With SQL Server Agent I am running schedule task of the backup script

The question is:

I would like to save only the last 7 days in repository.
This means that when the 8th days has become then the 1st day backup is deleted.
in the 9th day the 2nd day backup file is deleted.
and so on

I am using the the T-SQL BACKUP DATABASE command with the following arguments:
RETAINDAYS = 7
NOFORMAT
NOINIT
SKIP

I am in situation that the command above only append to the backup file and without deleting the expired backup days.

What I need to change in the parameters that the script will delete the expired backup days.


It is too much work when working with Database Maintenance Wizard.
lets take a scenario that I have 10 database.
I would like that each database will backup into seperate file.
I need to create 10 * 7 Maintenance plans.

I have created a directory with the name SDBbackup.
Now under the directory SDBbackup I have created 7 directories (1,2,3,4,5,6,7).
Each directory is for Sunday=1 , Monday=2 , and etc.

It's very much work if I need to accomplish it with Database Maintenance Wizard.

This is why I am asking a specific question regarding T-SQL.

Thanking in advance everyone who assist.

View 1 Replies View Related

DB Design :: Buffer Database - Insert Information From Partners Then Make Update To Main Database

Oct 29, 2015

I actually work in an organisation and we have to find a solution about the data consistancy in the database. our partners use to send details to the organisation and inserted directly in the database, so we want to create a new database as a buffer database to insert informations from the partners then make an update to the main database. is there a better solution instead of that?

View 6 Replies View Related

Cache Database Structure (How To Detect If Database-design Has Changed..)

Feb 24, 2006

Hello everyone,I have a webcontrol that uses database-structures alot, it uses the system tables in SQL to read column information from tables. To ease the load of the SQL server I have a property that stores this information in a cache and everything works fine.I am doing some research to find if there are anyway to get information from the SQL server that the structure from a table has changed.I want to know if a column or table has changed any values, like datatype, name, properties, etc.Any suggestions out there ?!

View 3 Replies View Related

Designing A Database Within A Database... Design Question Storing Data...

Jul 23, 2005

I have a system that basically stores a database within a database (I'msure lots have you have done this before in some form or another).At the end of the day, I'm storing the actual data generically in acolumn of type nvarchar(4000), but I want to add support for unlimitedtext. I want to do this in a smart fashion. Right now I am leaningtowards putting 2 nullable Value fields:ValueLong ntext nullableValueShort nvarchar(4000) nullableand dynamically storing the info in one or the other depending on thesize. ASP.NET does this exact very thing in it's Session State model;look at the ASPStateTempSessions table. This table has both aSessionItemShort of type varbinary (7000) and a SessionItemLong of typeImage.My question is, is it better to user varbinary (7000) and Image? I'mthinking maybe I should go down this path, simply because ASP.NET does,but I don't really know why. Does anyone know what would be the benifitof using varbinary and Image datatypes? If it's just to allow saving ofbinary data, then I don't really need that right now (and I don't thinkASP.NET does either). Are there any other reasons?thanks,dave

View 7 Replies View Related

Knowledgeable Yet Simple Book For Database Modelling Or Database Design

Aug 16, 2007

Hi All,Can u please suggest me some books for relational database design ordatabase modelling(Knowledgeable yet simple) i.e. from which we couldlearn database relationships(one to many,many to oneetc.....),building ER diagrams,proper usage of ER diagrams in ourdatabase(Primary key foreign key relations),designing smallmodules,relating tables and everything that relates about databasedesign....Coz I think database design is the crucial part of databaseand we must know the design part very first before starting up withdatabases.....Thanks and very grateful to all of you....Vikas

View 3 Replies View Related

Database Design- Referencing Multiple Database

Sep 27, 2007

Hi All,
I am designing database where few of the master tables will reside in different database or in case different server. Scenario is
Server "A" with Database "A" may host the "Accounts" table.
Server "B" with Database "B" may host the "Product" table.
I am designing database "Project" which will hosted in Server "A".
My application requires this master tables [readonly access] as data inserted in my application refers this tables. Also there are reports to be generated which refer this tables.
How do i design my database and sql queries?
I am thinking of approach of having equivalent tables created in my database and writing service which keep tables in my database in sync. This will ensure good perfomance during transaction and reports as they will need to refer this table locally as opposed to different database or different server.

Any thoughts on above approach?? or any better/standard way for such scenarios ?

Thanks in Advance. Your inputs will be of great help.

View 14 Replies View Related

Database Design - Multiple Vs. Single Database

Apr 12, 2007

Hello:

My client has a db with the following structure:

Online US Searchable Map of the 50 US States. Users search criteria is the following: Query records by selecting state, county, then record. Each County table has 10-20 tables. All databases combined = 500MB and TLogs = 100MB.

How would you re-design a relational DB where users could query data by state-county-record. Currenty the DB's are created by the County of each state which creates hundreds of DB's in SQLServer with no realtionship to each US state. What would be the best design to ensure good performance, data integrity and maintenance? Would you create 1 DB with all 50 states, create 4 DB's and divide by region(N,S,E,W), 50 DB's of each state or leave it as is with each county it's on DB? Any suggestions would be appreciated.

thx
rob

View 7 Replies View Related

Database Design???

Oct 20, 2006

Hello, I am designing my first database with 5 tables for a demo project and am not sure if it works. an example below.2 of the many things I want visitors to the site to do is find a company by the industry sector they belong to,..andwhat sort of service or products they can supply. For instance a Employment agency maybe under professional services  Table 1 Customer Customer_ID = primary key,,,, Sector_ID = Foreign keyComapany Name, Address, Phone, Postcode etcTabel 2 Industry SectorsSector_ID = primary key,,,,Customer_ID= foreign key banking, Education,Prof Services, etc  Table 3  Trading ActivityTrading_ID = primary key,,,,Sector_ID =  Foreign key, Products_ID= FkEmployment Agent, School, Lawyer etcTable 4 ProductsProducts_ID = primary key,,,,Trading_ID = foreign keySupply frozen foods, transport services, sports goods, etc  Table 5 Account Account_ID = primary key,,,,Customer_ID = foreign keyAccount Name, Credit Limit, Payment Terms, Open date, Account contact etc  One big point of confusion is, can I have the Customer_ID from the principal Customers tablein every table as a foreign key or must the tables be chained together one after the other as such. Advice appreciatedThanks 

View 1 Replies View Related

Database Design

Apr 10, 2007

Hi,
 I need a hand with designing a database.
 I am collecting results from a survey which has the following questions:
Call ref? How did you place your support call?  Were you satisfied with the amount of time you had to wait until getting acknowledgement of the support call placed? 1 = very satisfied and 10 = very unsatisfied.  How happy were you with the customer service you received upon placing the support call?   1 = very unhappy and 10 = very happy.How satisfied were you with the amount of time you had to wait until you heard from an engineer? 1 = very satisfied and 10 = very unsatisfied.   How satisfied were you with the time taken to get your problem/query resolved? 1 = very satisfied and 10 = very unsatisfied  Did you feel the engineer had enough knowledge to deal with your call? 1 = very good and 10 = not very good  Overall how satisfied were you with the support call placed? 1 = very satisfied and 10 = very unsatisfiedIs there anything we can do to improve the quality of the support and service you received?
I want to store this in a database.  Obviously I want to use best practice for design, normalisation etc.  The stumbling block I am coming accross is the fact that each question has a number and each question has a score from 1 to 10 and storing this in the database.  Any help appreciated!
Thanks
Andrew 
 

View 9 Replies View Related

Database Design

Apr 26, 2007

I am creating database tables for company testimonials.  Database columns: name, position, companyname, comment, service we provided. 
My question is that for each company - may have a multitude of different services from us, and different people with different positions in the same company may make comments.
What is best practice for putting this db structure together?
Thanks
Andrew

View 1 Replies View Related

Database Design

Oct 29, 2007

 Can anyone tell me how can i design database architecture for the Table Category & Product...so that i can make N-level entity relation....I have database in SQL SERVER 2000. 

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved