|
MSSQL you can create a stored procedure to do the insert and then schedule a job to execute the procedure when required.
MySQL - I don't know.
As suggested you could use a windows service to do both inserts.
|
|
|
|
|
Thanks for the reply.Here the constraint is I cannot use Windowse services.So, I will schedule a job whichi will fire on each day at specific time.In this job i will call the SP which will insert or update the desired record.I hore in MYSQL ALSO it will works.Right....
Thanks,
Srinivas Mateti
|
|
|
|
|
If MySQL does not support jobs then you may be able to trick SQL Server into doing the job on MySQL as a remote server or a linked server, nasty but it may be possible.
|
|
|
|
|
Oho..This will create more problem for me.I cannot use SQLSERVER to trigger MYSQL.I canot use windowse services.But I need the auto insert action...Is there any other option in MySQl which is similar to MSSQL jobs feature.Please guide me.
Thanks in advance,
Srinivas Mateti
|
|
|
|
|
MySQL has an event scheduler which can be used to fire off tasks at specified times or intervals.
|
|
|
|
|
Triggers execute in response to certain events when INSERT, UPDATE or DELETE
|
|
|
|
|
So in this case I cant use triggers..right?
|
|
|
|
|
|
u hv to write a windows service for this.where u can set the exact time.
Thanks and Regards
Sujit Kr. Mandal
|
|
|
|
|
no need to invent the wheel again Sql server job will do the job
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
I think you can create a stored procedure for the insertion and call it from a SQL job that's it;
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
Thanks
Md. Marufuzzaman
|
|
|
|
|
Hi I am in process of designing a online employee timesheet application which allows employee to record hours and manager to approve number of hours worked. could someone please point me to links which gives me idea on how to create tables i.e. employee, timecard, etc
|
|
|
|
|
Hi uglyeyes--
You have been a member long enough that CodeProject is not here to answer generic questions such as these. Your question is one where most would probably tell you to "just Google it." Creating a basic database and its tables is part of the learning process. Sit down, take some time, and think it out.
|
|
|
|
|
What exactly is your question?
How to create table called employee, timecard etc in some database?
or
You are looking for guidance related to database design?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Which Tools are you using to do this , you have not explain that you are going to use Sql Server or MySql , for online System i will recommend MySql any how here is the link for Ms Sql Server
http://databases.about.com/od/sqlserver/ss/sqlservertables.htm[^]
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
u can create this sample tables
CREATE TABLE [dbo].[ATTENDANCE](
[AttendanceID] [int] IDENTITY(1,1) NOT NULL,
[EmployeeID] [int] NULL,
[AttendanceCreatedDate] [datetime] NULL,
[AttendanceCreatedByUserID] [int] NULL,
[AttendanceDate] [datetime] NULL,
[InTime] [datetime] NULL,
[OutTime] [datetime] NULL,
[WorkDuration] [int] NULL,
[IsOverTime] [bit] NULL CONSTRAINT [DF_Attendance_IsOverTime] DEFAULT ((0)),
[AttendanceComments] [varchar](1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_Attendance] PRIMARY KEY CLUSTERED
(
[AttendanceID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [UK_Attendance] UNIQUE NONCLUSTERED
(
[EmployeeID] ASC,
[AttendanceDate] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Thanks and Regards
Sujit Kr. Mandal
|
|
|
|
|
Hi Guys,
thanks for your response. I should have been more specific. I have already created few tables which are as below.
Employee, EmployeeType, Jobtitle,
Period (PeriodId PeriodStartDate PeriodEndDate),
timeCard(TimeCardId,PeriodId,EmployeeId,Date,StartTimeAM,EndTimeAM,StartTimePM,EndTimePM,BreakTaken,UpdatedDate,IsApproved)
period
17 2009-09-21 00:00:00 2009-09-27 00:00:00
timecard for one week for one employee
1 17 1 2009-09-21 00:00:00 1900-01-01 06:15:00 1900-01-01 11:30:00 1900-01-01 17:15:00 1900-01-01 12:00:00 1900-01-01 01:00:00 2009-10-01 11:38:00 0
2 17 1 2009-09-22 00:00:00 1900-01-01 06:15:00 1900-01-01 11:30:00 1900-01-01 17:15:00 1900-01-01 12:00:00 1900-01-01 01:00:00 2009-10-01 11:38:00 0
3 17 1 2009-09-23 00:00:00 1900-01-01 06:15:00 1900-01-01 11:30:00 1900-01-01 17:15:00 1900-01-01 12:00:00 1900-01-01 01:00:00 2009-10-01 11:38:00 0
4 17 1 2009-09-24 00:00:00 1900-01-01 06:15:00 1900-01-01 11:30:00 1900-01-01 17:15:00 1900-01-01 12:00:00 1900-01-01 01:00:00 2009-10-01 11:38:00 0
5 17 1 2009-09-25 00:00:00 1900-01-01 06:15:00 1900-01-01 11:30:00 1900-01-01 17:15:00 1900-01-01 12:00:00 1900-01-01 01:00:00 2009-10-01 11:38:00 0
6 17 1 2009-09-26 00:00:00 1900-01-01 06:15:00 1900-01-01 11:30:00 1900-01-01 17:15:00 1900-01-01 12:00:00 1900-01-01 01:00:00 2009-10-01 11:38:00 0
7 17 1 2009-09-27 00:00:00 1900-01-01 06:15:00 1900-01-01 11:30:00 1900-01-01 17:15:00 1900-01-01 12:00:00 1900-01-01 01:00:00 2009-10-01 11:38:00 0
for you to understand I have provided columns of period and timecard. this web application is used by hospitality industry.
employee works shifts like 7am-12pm and 6pm-2am
Now, I am thinking I shouldnt store computed values.
My problem is how do i work it out below:
If they work after mid-night they should get penalty and those two hours after midnight should be moved to record
also I dont know how to calculate their pay.
could you please help?
|
|
|
|
|
Ok, to simply it. how can I compare the time value as an input. my idea is if they type endtime anything bigger than 12.00am I need to compare mid-night time and @endtime, if @endtime is after midnight I need to add to append the hours next day in next row.
declare @starttime smalldatetime
declare @endtime smalldatetime
set @starttime='18:20'
set @endtime ='2:00'
print DATEADD(hh, DATEPART(hour,@EndTime), DATEADD(mi,DATEPART(mi,@EndTime),DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0)) )
print DATEADD(dd, DATEDIFF(dd, 0, GETDATE()),0)
Hope that makes sense?
thank you
modified on Monday, October 5, 2009 8:45 PM
|
|
|
|
|
To make your design more flexible, you need to implement a parent / child relationship where the master is the Timecard and the child records represent slices of time within that timecard. Each time slice can have attributes like Paid/Unpaid, Payrate, Workcode (Work, Absence, Break), Absence code, start time, end time.
For example:
WORK 7:00 - 9:00
BREAK 9:00 - 9:15
WORK 9:15 - 12:00
BREAK 12:00 - 13:00
WORK 13:00 - 17:00
Consider going to CodePlex to see what other people have developed, there may be a solution already out there.
|
|
|
|
|
Hi, thanks I went to codeplex but I couldnt find the solution i was looking for. could you please give me an idea how the table relationship might look like between timecard and time slices. thanks once again
|
|
|
|
|
Here is a rough idea of how you could design a time keeping database ...
Table: Timecard_Header
HID - Primary key Auto generated sequence number. (Header ID)
EMPID - Key to the employee table
TCDATE - Timecard date
TIME_IN - Datetimestamp of when the timecard begins (shift start) Include the date portion incase the shift begins at 11pm and runs across midnight
TIME_OUT - Datetimestamp
Table: Timecard_Details
DID - Primary key. Sequence number (detail ID)
HID - Foreign key reference back to the header record
TIME_START - Beginning time for this time slice
TIME_END - Ending time for this time slice
TDTYPE - Timecard deail type (Use this to indicate Work, Break, Absence, etc)
TDCODE - Used as a further explaination of the type, for example Absence - Vacation or Absence - Jury duty
PCODE - Paycode (0 - Unpaid, 1 - Regular pay, 2 - Overtime, 3 - Doubletime, etc)
PRate - Pay rate show the actual rate paid for this time slice. $10/hr Regular pay or $15 / hr for overtime
This should give you an idea of one way of looking at the data, you should extend this model to meet your requirements.
|
|
|
|
|
This should work, but it keeps returning a "could not be opened. Operating system error code 5(Access is denied.)."
select * from Openrowset (BULK '\\nvBeast\dropzone\img.jpg',SINGLE_BLOB) AS [Image]
Googling shows that many have the same problem, but I could not find any answers.
Anyone got a clue?
If the post was helpful, please vote, eh!
Current activities:
Book: Devils by Fyodor Dostoyevsky
Project: Hospital Automation, final stage
Learning: Image analysis, LINQ
Now and forever, defiant to the end.
What is Multiple Sclerosis[ ^]?
|
|
|
|
|
Have you read the Books Online ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/18a64236-0285-46ea-8929-6ee9bcc020b9.htm, the Security Considerations section?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
nice link.
Thanks and Regards
Sujit Kr. Mandal
|
|
|
|
|
OPENROWSET: Includes all connection information necessary to access remote data from an OLE DB data source. This method is an alternative to accessing tables in a linked server and is a one-time, ad hoc method of connecting and accessing remote data using OLE DB. The OPENROWSET function can be referenced in the FROM clause of a query as though it is a table name. The OPENROWSET function can also be referenced as the target table of an INSERT, UPDATE, or DELETE statement, subject to the capabilities of the OLE DB provider. Although the query may return multiple result sets, OPENROWSET returns only the first one.
If you use any network path, please confirm that your SQL login user is permitted to perform bulk load on the Operating System.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
Thanks
Md. Marufuzzaman
|
|
|
|
|