Click here to Skip to main content
15,894,460 members
Home / Discussions / Database
   

Database

 
AnswerRe: DateTime Updating Problem in sql2000? Pin
Chris Meech5-Dec-05 3:41
Chris Meech5-Dec-05 3:41 
QuestionSQL Server 2005 Report Builder Pin
su772-Dec-05 12:40
su772-Dec-05 12:40 
QuestionRemove duplicates from result set Pin
jszpila2-Dec-05 4:48
jszpila2-Dec-05 4:48 
AnswerRe: Remove duplicates from result set Pin
sreejith ss nair2-Dec-05 6:10
sreejith ss nair2-Dec-05 6:10 
GeneralRe: Remove duplicates from result set Pin
jszpila2-Dec-05 6:22
jszpila2-Dec-05 6:22 
GeneralRe: Remove duplicates from result set Pin
sreejith ss nair2-Dec-05 6:24
sreejith ss nair2-Dec-05 6:24 
GeneralRe: Remove duplicates from result set Pin
jszpila2-Dec-05 6:27
jszpila2-Dec-05 6:27 
QuestionHelp Me plz abt this dateTime UDF_Function? Pin
majidbhutta1-Dec-05 15:32
majidbhutta1-Dec-05 15:32 
below is the function that compares only time .there are 3 datetime variables.
@StartTime datetime
@EndTime datetime
@DayTime datetime

@StartTime is always less than @EndTime regardless of its
dates.and @DayTime may be any time. We have to calculate
whether @DayTime lies between @StartTime and @EndTime or
not. And on its behalf we return a value.
if @DayTime lies between @StartTime and @EndTime return 1
else return 0.But tested with these values result is not ok.
set @StartTime='12/1/2005 12:30:49 PM'
set @EndTime='12/2/2005 4:30:49 AM'
set @DayTime='2005-12-02 00:56:02.730'
select dbo.udf_IsShiftValid(@StartTime,@EndTime,@DayTime )

it returns 0 where i think it should return 1. plz correct
me where m i wrong.

Actually i have to use this function on CheckInShfit event of the Employee. @StartTime and @EndTime are the time of the shifts that have already been defined in the database very ago. Now whenever Employee ChecksIn we have to confirm wheather he is entering Between his shift timing that have been Defined already in the database, if his CheckInTime (only time not date) @DayTime lies between his @StartTime and @EndTime then he is allowed to enter (i.e 1) else Not(0).
Now keeing in view the baove Scenario, plz guide me
plz modify this function so as it returns 1 if the @DayTime

Lies Between @StartTime And @EndTime else one( BUt keep in

Mind i m required to compare only time not the dates and

@startTime value is always less than @EndTime value)

CREATE FUNCTION dbo.udf_IsShiftValid(@StartTime datetime,

@EndTime datetime,@DayTime datetime)
RETURNS int AS
BEGIN
DECLARE @RtValue AS int

IF
convert(varchar,@DayTime,114)>=
convertvarchar,@StartTime,114) AND

convert(varchar,@DayTime,114)<
(convert(varchar,@EndTime,114)
BEGIN
SET @RtValue=1
END
ELSE
BEGIN
SET @RtValue=0
END

RETURN @RtValue
END

-- modified at 21:40 Thursday 1st December, 2005
AnswerRe: Help Me plz abt this dateTime UDF_Function? Pin
sreejith ss nair2-Dec-05 6:47
sreejith ss nair2-Dec-05 6:47 
QuestionOLEDB data source issue Pin
Joshua Lunsford1-Dec-05 13:06
Joshua Lunsford1-Dec-05 13:06 
QuestionDatabase sample Pin
sasan561-Dec-05 9:44
sasan561-Dec-05 9:44 
AnswerRe: Database sample Pin
Raj Lal1-Dec-05 10:56
professionalRaj Lal1-Dec-05 10:56 
GeneralRe: Database sample Pin
sasan561-Dec-05 10:59
sasan561-Dec-05 10:59 
GeneralRe: Database sample Pin
Raj Lal1-Dec-05 11:16
professionalRaj Lal1-Dec-05 11:16 
Questioncrystal report problem Pin
sasan561-Dec-05 9:41
sasan561-Dec-05 9:41 
Questiondatagrid updation Pin
smdbt1-Dec-05 6:46
smdbt1-Dec-05 6:46 
QuestionTransfer local sql database to web-server Pin
Rama Sharma1-Dec-05 5:46
Rama Sharma1-Dec-05 5:46 
AnswerRe: Transfer local sql database to web-server Pin
Farhan Noor Qureshi1-Dec-05 7:15
Farhan Noor Qureshi1-Dec-05 7:15 
GeneralRe: Transfer local sql database to web-server Pin
Rama Sharma1-Dec-05 14:39
Rama Sharma1-Dec-05 14:39 
GeneralRe: Transfer local sql database to web-server Pin
Farhan Noor Qureshi2-Dec-05 6:24
Farhan Noor Qureshi2-Dec-05 6:24 
Questionget last 7 days inserted Record Pin
imshally811-Dec-05 1:21
imshally811-Dec-05 1:21 
AnswerRe: get last 7 days inserted Record Pin
sreejith ss nair2-Dec-05 6:51
sreejith ss nair2-Dec-05 6:51 
AnswerRe: get last 7 days inserted Record Pin
S Douglas7-Dec-05 0:33
professionalS Douglas7-Dec-05 0:33 
QuestionHow to write a SQL Function to Find Internal Return Rate(IRR) Value ? Pin
pubududilena30-Nov-05 23:17
pubududilena30-Nov-05 23:17 
AnswerRe: How to write a SQL Function to Find Internal Return Rate(IRR) Value ? Pin
Colin Angus Mackay1-Dec-05 0:24
Colin Angus Mackay1-Dec-05 0:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.