April 15, 2010 at 12:22 am
actually what is ssis pakage life cycle
April 16, 2010 at 12:24 am
Please don't crosspost into multiple forums.
You'll find some answers here:
http://www.sqlservercentral.com/Forums/Topic903774-148-1.aspx
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
April 19, 2010 at 7:26 am
HI All,
am unable to retrieve a data between certain time
My table has a Data like this
Filed Name:Datescheduled
2010-04-15 18:51:12.750
2010-04-16 14:10:39.450
2010-04-16 15:34:52.107
2010-04-16 18:56:40.920
2010-04-16 18:56:40.920
2010-04-17 17:20:55.310
2010-04-17 17:22:08.640
2010-04-17 17:23:11.420
2010-04-17 17:26:53.107
2010-04-17 17:29:04.840
2010-04-17 17:31:12.750
2010-04-19 16:00:46.123
2010-04-19 16:16:33.950
2010-04-19 16:20:22.967
2010-04-19 16:20:22.967
2010-04-19 16:21:00.810
2010-04-19 00:00:00.000
I need to retrieve data between certain time
eg:
DECLARE @StartTime datetime
DECLARE @EndTime datetime
SET @StartTime = '04:00 PM'
SET @EndTime = '07:15 PM'
SELECT
DateScheduled,
FROM
TicketDetails
WHERE
AND DateScheduled >= @StartTime
AND DateScheduled <= @EndTime
Thanks & regards
kjkeyan
April 19, 2010 at 7:36 am
Regardless of the fact that is the wrong forum and topic, an answer to your question:
the datatype datetime is used to store AND the date portion AND the time portion.
You are filtering on the time portion only, which of course won't work.
So you have two options:
1. Use the date datatype and the time datatype if you are workign on SQL Server 2008. (I don't know if you do, it helps if you state such information in your question).
2. Store the time values (e.g. 04.00 PM) together with a dummy date in the datetime datatype.
E.g. your table looks like this:
CREATE TABLE #DateTime_Table (ID int, Date_Portion datetime, Time_Portion datetime)
INSERT INTO #DateTime_Table VALUES (1, '2010-04-19', '1900-01-01 3:20:26 PM')
SELECT * FROM #DateTime_Table
Now you can filter with the SQL Statement you created on the column Time_Portion.
A final hint: also post the error messages you get.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply