Query Time Outs..
Jun 5, 2001
Hi, We have a SQL 7 / Win2K cluster and yesterday afternoon the users were complaining about poor performance. Their queries were timing out.. (Not all of them, just some on some large tables)
I ran just an ad-hoc query against the table from my machine and I also timed out. THen I went right to the box that had control of the cluster and did the same thing there and also timed out. Because of time constraints (and we are in testing mode) we tested a failover and everything was back to normal after that.
So now we want to try to figure out what could have been the problem. At the time I checked out the Memory and CPU usage and they were very low (0-5%) and using only 1/3 of the memory. It couldn't be a bad query or index because after the failover it worked fine.
Could there be something wrong with the specific box that had control at the time? I dont' know where to look?
Any ideas would be appreciated!
View 1 Replies
ADVERTISEMENT
Jul 20, 2005
Hi All.I have some rather large SQL Server 2000 databases (around 60GB).I have set up jobs to re-index the tables and update statistics everysunday. This worked will for a few months. Now after a day or two ofusing it the connections to it keep timing out. If i start the jobsmanually, all is well for two days or so.Surely there can be a better solution to this ?TIA.Ryan,.
View 2 Replies
View Related
Aug 7, 2007
We have several SQL 2000 databases on one server.
One of the applications I'm responsible for has batch jobs that run for an hour; all activity is on the database. During this hour, other applications that use other databases on the same server experience time-outs. One of my coworkers did a count(*) on an empty table and it took 11 seconds.
We pay people to keep our servers up and running. Is this something they might solve by reconfiguring the server? It seems strange to me that a single database is allowed to hog all server resources.
We are meeting with them later this week, and I'd like to have some knowledge about this; we don't want to BS'ed into buying a new server.
View 2 Replies
View Related
Jul 20, 2005
The C++ application calls the database to look up property data. Onetroublesome query is a function that returns a table, finding data whichis assembled from four or five tables through a view that has a join,and then updating the resulting @table from some other tables. Thereare several queries inside the function, which are selected accordingto which parameters are supplied (house #, street, zip, or perhaps parcelnumber, or house #, street, town, city,...etc.). If a lot of parametersare provided, and the property is not in the database, then several queriesmay be attempted -- it keeps going until it runs out of queries or findssomething. Usually it takes ~1-2 sec for a hit, but maybe a minute insome failure cases, depending on the distribution of data. (~100 milproperties in the DB) Some queires operate on the assumption the input datais slightly faulty, and take relatively a long time, e.g., if WHEREZIP=@Zip fails, we try WHERE ZIP LIKE substring(@Zip,1,3)+'%'. Whileall this is going on the application may decide the DB is never going toreturn, and time out; it also seems more likely to throw an exception thelonger it has to wait. Is there a way to cause the DB function to fail ifit takes more than a certain amount of time? I could also recast it asa procedure, and check the time consumed after every query, and abandonthe search if a certain amount of time has elapsed.Thanks in advance,Jim Geissman
View 3 Replies
View Related
Dec 22, 2006
I recently installed sharepoint 3.0 on our fileserver, which has our main db using MSDE. I didn't know at the time that it would also install 2k5 embedded edition, but even if I had, I don't think it would have changed my decision.
Anyway, soon after, performance on MSDE completely tanked. Queries would execute extremely slowly, or not at all. I checked the CPU and mem usage, and all were fine. No blocked sql commands either. We ended up just killing the Sql 2k5 EE service. We're moving off MSDE eventually, but I would still like to find out why it happened, and if there's a fix or workaround.
If anyone has any ideas, I'm all ears.
View 3 Replies
View Related
Jun 20, 2007
Okay, we have are running our Master Package (and therefore all related Child packages) through a .bat file. The .bat file is scripted using the following logic for an entire month of daily runs:
Code Snippet
DTExec /FILE E:ETLFinancialDataMartMaster.dtsx /DECRYPT masterpwd /SET Package.Variables[ReportingDate].Value;"2/01/2007" > E:ETLErrorLogsProcessingetl_20070201log.txt
IF NOT %ERRORLEVEL%==0 GOTO ERROR%ERRORLEVEL%
mkdir E:ETLErrorLogsArchive20070201
move E:ETLErrorLogsProcessing*.txt E:ETLErrorLogsArchive20070201
DTExec /FILE E:ETLFinancialDataMartMaster.dtsx /DECRYPT masterpwd /SU /SET Package.Variables[ReportingDate].Value;"2/02/2007" > E:ETLErrorLogsProcessingetl_20070202log.txt
IF NOT %ERRORLEVEL%==0 GOTO ERROR%ERRORLEVEL%
mkdir E:ETLErrorLogsArchive20070202
move E:ETLErrorLogsProcessing*.txt E:ETLErrorLogsArchive20070202
etc...
Generally it takes about 40-45 minutes to run one days worth of data. However, we have found unpredictable instances where the job will take 3 hours or even 6 hours and appear to hang....
The weirdness sets in when we kill the job and rerun it. In all instances of a rerun, the job will execute in the normal 40-45 minute time frame. Obviously, we would like to institute some sort of logging, monitoring and error handling....including if need be a method to timeout a process and restart it.
I am reviewing the WMI (Windows Management Instrumentation) Task but I'm not entirely convinced that it's the right tool for the job.
Questions:
Has anyone else experienced the type of processing behavior that I described?
Has anyone been successful at using WMI or another process to monitor and timeout packages? If so, are there sample packages or a good tutorial that maps it out?
Unrelated to this issue, we also have instances incomplete processing logs. The logs don't finish writing and the weird part is that they all end at the same point, does anyone have experience with incomplete job logs?:
Code SnippetProgress: 2007-06-20 12:46:49.87
Source: Update factFinancial Data Flow
Cleanup: 11% complete
Thanks in advance!
View 1 Replies
View Related
Feb 18, 2004
Hi everyone! I'm new to this forum and I suspect I'll be using this forum frequently. Good stuff.
Allow this question may appear to be Web-related, I think the problem is with what I'm doing with the database. Please read.
I'm trying to implement a page tracking solution using ASP and SQL 2000. It basically writes a new record to a table every time a user visits a page on the site. It appeared to work fine at first, then I've increasingly been getting time out errors on my pages -- all pointing to the include file that fires the database write.
Here's the code that's referenced on every page:
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "dsn=x;uid=y;pwd=z;"
Set objRecordset1= Server.CreateObject("ADODB.Recordset")
objRecordset1.Open "SELECT * FROM table",Conn,1,2
objRecordset1.AddNew
objRecordset1.Fi elds("PAGE") = Left(request.servervariables("SCRIPT_NAME"),100)
objReco rdset1.Fields("QUERY_STRING") = Left(request.servervariables("QUERY_STRING"),100)
objRec ordset1.Fields("DATE") = Date()
objRecordset1.Fields("TIME") = Time()
objRecordset1.Fields("PLATFORM") = Left(request.servervariables("HTTP_USER_AGENT"),100)
obj Recordset1.Fields("REFERRER") = Left(request.servervariables("HTTP_REFERER"),100)
objRec ordset1.Fields("USER_IP") = Left(request.servervariables("REMOTE_ADDR"),20)
If Request.Cookies("TEST")("ID")<>"" Then
objRecordset1.Fields("VISITOR_ID") = Request.Cookies("TEST")("ID")
End If
objRecordset1.Update
Conn.Close
Set Conn=Nothing
%>
After taking out the reference to the above code everything speeds back up. So, I know the performance hit and time out issues have to do with the code above.
Is it the simultaneous write to the table, the constant opening and closing of the recordset, the cursor type, the lock type – or combination of things?
HELP!! Thanks!
David
View 3 Replies
View Related
Nov 28, 2006
First thanks for your time.
We have 4 clustered SQL2000 Servers each contains information specific to its application related to customer information in a casino player tracking database. My problem is as follows On the Playertracking database I can join and return information from the tables there with no problems the performance accross the decently sizable transactional based table is pretty decent. The problem is I need to filter this query down by the Type of machine the customer plays. The child key exists in the playertransaction table the parent key is on another server. Here is the lay out of the tables unecessary information from the tables were truncated for brevity.
CREATE TABLE [dbo].[PlayerSession] (
[PlayerId] [int] NOT NULL ,
[Mnum] [int] NOT NULL ,
[CoinIn] [money] NOT NULL ,
[CoinOut] [money] NOT NULL ,
[Games] [int] NOT NULL ,
[Jackpot] [money] NULL ,
[Win] [money] NULL ,
[TheoWin] [money] NOT NULL ,
[PlayerMod] [tinyint] NOT NULL
) ON [PRIMARY]
-- Player Demographics information
CREATE TABLE [dbo].[Player] (
[PlayerId] [int] NOT NULL ,
[Status] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Title] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[FirstName] [varchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[MiddleName] [varchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[LastName] [varchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[SSN] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
) ON [PRIMARY]
--Machine Information that links to Machine Type table
CREATE TABLE [dbo].[Machine] (
[MNum] [int] NOT NULL ,
[MachineTypeId] [smallint] NOT NULL ,
) ON [PRIMARY]
-- Machine type code table
CREATE TABLE [dbo].[MachineType] (
[MachineTypeId] [smallint] NOT NULL ,
[Denom] [int] NOT NULL ,
[Par] [decimal](6, 2) NOT NULL ,
[GameType] [varchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
) ON [PRIMARY]
From the server where all the player information is ran I can query the linked database for the machine and machine type information like this.
SELECT m.MNum, mt.MachineTypeId, mt.GameType, mt.DisplayType
FROM ACCTV.Accounting.dbo.Machine m INNER JOIN
ACCTV.Accounting.dbo.MachineType mt ON m.MachineTypeId = mt.MachineTypeId
This is the information I am trying to get out but the query times out on me.
SELECT Player.PlayerId, Player.FirstName, Player.LastName, SUM(PlayerSession.CoinIn) AS sumCI, SUM(PlayerSession.CoinOut) AS SumCO,SUM(PlayerSession.TheoWin) AS SumTheo, AVG(PlayerSession.TheoWin) AS AvgTheo, SUM(PlayerSession.Win) AS SumWin, AVG(PlayerSession.Win) AS AvgWin, mt.GameType
FROM Player INNER JOIN
PlayerSession ON Player.PlayerId = PlayerSession.PlayerId INNER JOIN
ACCT.Accounting.dbo.Machine M ON PlayerSession.Mnum = M.MNum INNER JOIN
ACCT.Accounting.dbo.MachineType mt ON M.MachineTypeId = mt.MachineTypeId
GROUP BY Player.PlayerId, Player.FirstName, Player.LastName, mt.GameType
The other option would be some sort of SubQuery but I dont know how to return results from the subqueries to the root query to be returned to the restulting recordset. I am not necessarily looking for an answer more of looking for a direction to go to find my solution.
Thanks again for your help.
View 1 Replies
View Related
Oct 6, 2006
Hi
I am joining the thread that initially Mike started. We have a x64 bit SQL Server with 32GB RAM. On start up sqlserver.exe starts with 15 to 20MB of RAM. After that the memory gradually increases at a step of 100MB and reaches 31.8 GB at the end. We don't see a out of memory situation so far and the memory remains the same, once the sqlserver.exe reaches that level we are facing application in stability issue. There is no other application running in this server. At present the database size is 28GB and we have employed the following,
There is a database replication running
A weekly maintenance plan to reindex, backup and other maintenance is running.
There is a log back up job which runs once in 2hrs time.
The temdb size grows to 3gb max. We didn't see any temp table created left out orphan in the temdb.
We have the required indexes placed in the tables to reduce the scan time. Also the server is configured to use dynamic memory allocation that is all are factory settings.
The database is encounters on an average 200 to 500 connections at a time. One observation is the memory goes up as soon as the replication starts, this is at one of the 2 servers.
Please advise what is causing this issue and how to go abt it.
View 2 Replies
View Related
Apr 21, 2015
SELECTÂ
  CONVERT(VARCHAR(10),attnc_chkin_dt,101) as INDATE,
  CONVERT(VARCHAR(10),attnc_chkin_dt,108) as TimePart
FROM pmt_attendance
o/p
indate   04/18/2015
time part :17:45:00
I need to convert this 17:45:00 to 12 hours date format...
View 8 Replies
View Related
May 26, 2005
Hi,
I have a table which has a few fields, one being "datetime_traded". I need to write a query which returns the row which has the closest time (down to second) given a date/time. I'm using MS SQL.
Here's what I have so far:
Code:
select * from TICK_D
where datetime_traded = (select min( abs(datediff(second,datetime_traded , Convert(datetime,'2005-05-30:09:31:09')) ) ) from TICK_D)
But I get an error - "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.".
Does anyone know how i could do this? Thanks a lot for any help!
View 2 Replies
View Related
May 15, 2008
Hello All,
Below carry takes too much time while execution
Select
'PIT_ID' = CASE WHEN Best_BID_DATA.PIT_ID IS NOT NULL THEN Best_BID_DATA.PIT_ID ELSE Best_OFFER_DATA.PIT_ID END,
Best_Bid_Data.Bid_Customer,
Best_Bid_Data.Bid_Size,
Best_Bid_Data.Bid_Price,
Best_Bid_Data.Bid_Order_Id,
Best_Bid_Data.Bid_Order_Version,
Best_Bid_Data.Bid_ProductId,
Best_Bid_Data.Bid_TraderId,
Best_Bid_Data.Bid_BrokerId,
Best_Bid_Data.Bid_Reference,
Best_Bid_Data.Bid_Indicative,
Best_Bid_Data.Bid_Park,
Best_Offer_Data.Offer_Customer,
Best_Offer_Data.Offer_Size,
Best_Offer_Data.Offer_Price,
Best_Offer_Data.Offer_Order_Id,
Best_Offer_Data.Offer_Order_Version,
Best_Offer_Data.Offer_ProductId,
Best_Offer_Data.Offer_TraderId,
Best_Offer_Data.Offer_BrokerId,
Best_Offer_Data.Offer_Reference,
Best_Offer_Data.Offer_Indicative,
Best_Offer_Data.Offer_Park
from
(
Select PITID PIT_ID, CustomerId Bid_Customer, Size Bid_Size, Price Bid_Price, orderid Bid_Order_Id, Version Bid_Order_Version,
ProductId Bid_ProductId, TraderId Bid_TraderId, BrokerId Bid_BrokerId,
Reference Bid_Reference, Indicative Bid_Indicative, Park Bid_Park
From OrderTable C
Where
version = (select max(version) from OrderTable where orderid = c.orderid)
and BuySell = 'B'
and Status <> 'D'
and Park <> 1
and PitId in (select distinct pitid from MarketViewDef Where MktViewId = 4)
and Price =
( Select max(Price) From OrderTable cc
where version = (select max(version) from OrderTable where orderid = cc.orderid)
and PitId = c.PitId
and BuySell = 'B'
and Status <> 'D'
and Park <> 1
)
and Orderdate =
( Select min(Orderdate) From OrderTable dd
where version = (select max(version) from OrderTable where orderid = dd.orderid)
and PitId = c.PitId
and BuySell = 'B'
and Status <> 'D'
and Price = c.Price
and Park <> 1
)
and OrderId = (select top 1 OrderId from OrderTable ff
Where version = (select max(version) from OrderTable where orderid = ff.orderid)
and orderid = ff.orderid
and PitId = c.PitId
and BuySell = 'B'
and Status <> 'D'
and Price = c.Price
and Orderdate = c.Orderdate
and Park <> 1
)
) Best_Bid_Data
full outer join
(
Select PITID PIT_ID, CustomerId Offer_Customer, Size Offer_Size, Price Offer_Price, orderid Offer_Order_Id, Version Offer_Order_Version,
ProductId Offer_ProductId, TraderId Offer_TraderId, BrokerId Offer_BrokerId,
Reference Offer_Reference, Indicative Offer_Indicative, Park Offer_Park
From OrderTable C
Where
version = (select max(version) from OrderTable where orderid = c.orderid)
and BuySell = 'S'
and Status <> 'D'
and Park <> 1
and PitId in (select distinct pitid from MarketViewDef Where MktViewId = 4)
and Price =
( Select min(Price) From OrderTable cc
where version = (select max(version) from OrderTable where orderid = cc.orderid)
and PitId = c.PitId
and BuySell = 'S'
and Status <> 'D'
and Park <> 1
)
and Orderdate =
( Select min(Orderdate) From OrderTable dd
where version = (select max(version) from OrderTable where orderid = dd.orderid)
and PitId = c.PitId
and BuySell = 'S'
and Status <> 'D'
and Price = c.Price
and Park <> 1
)
and OrderId = (select top 1 OrderId from OrderTable ff
Where version = (select max(version) from OrderTable where orderid = ff.orderid)
and orderid = ff.orderid
and PitId = c.PitId
and BuySell = 'S'
and Status <> 'D'
and Price = c.Price
and Orderdate = c.Orderdate
and Park <> 1
)
) Best_Offer_Data
ON Best_Bid_Data.Pit_Id = Best_Offer_Data.Pit_Id
Can any one please help me?
Thanks
Prashant
View 2 Replies
View Related
Aug 7, 2007
Hi all,
I have created a report in SSRS 2005 which is being viewed by users from different Time Zones.
I have a dataset which has a field of type datetime (UTC). Now I would like to display this Date according to the User Time Zone.
For example if the date is August 07, 2007 10:00 AM UTC,
then I would like to display it as August 07, 2007 03:30 PM IST if the user Time Zone is IST.
Similarly for other Time Zones it should display the time accordingly.
Is this possible in SSRS 2005?
Any pointers will be usefull...
Thanks in advance
sudheer racha.
View 5 Replies
View Related
Nov 14, 2007
My asp.net application is attached with SQL database, I record only time in my SQL database , field type is nvarchar. Now I want to do qurey by time and pull the result , but datatype of field in nvarchar, query does not giving me right result.
some one tell me how Do I do query so I can get proper result.
thanks maxmax
View 3 Replies
View Related
Nov 16, 2007
I have asp.net applicatin with SQL database communicating. in database I have date field and time field. Now I wan to do SQL query which can pull informatin on particular date between given start time to given end time
Can some one show me sample SQL query so I can pull informatin on particular day between two times
thank you
maxmax
View 2 Replies
View Related
Feb 4, 2008
How do I find all the records within a time range when all the datetime's are on different days?
Example: Show me all the order placed between 12:00 and 15:00 in May
View 1 Replies
View Related
Nov 21, 2007
hi,
how can i define a simple time-out exceed when running a simple select query like
select a from atable where a > 1
and define if query doesn't give results in 5 sec, it should be stopped.
View 2 Replies
View Related
Apr 8, 2008
I need to time a query down to hundredths of a second. I can see from the runtime clock in SQL Studio that my query ran for 00:00:00. However, I need to know exactly how long it took.
Thanks for your help!
View 4 Replies
View Related
Oct 5, 2007
Hello,I have a table that lists a number of available time slots for a party venue. I want a user to select a particular time slot and have the query show results for that time slot plus two time slots before and two time slots after the user's selection. If the user selects a time slot that is the first of the day, I still want that user to be shown 5 results including the one he selected. The same goes for the last time slot of the day. Can anyone help me with the SQL statement?
Thank you very much in advance!
Mark
View 12 Replies
View Related
Feb 18, 2004
I am using SQL Server and ASP.NET. I am executing a couple of stored procedures and displaying the results in a datagrid. Since these Stored procedures takes around 2-4 minutes each, I want to display a status bar on the web by displaying the approximate time the user needs to wait before seeing the results.
My question is: Is there a way to find out the approximate EXECUTION TIME of the stored procedure before hand. Also, if that is possible, how do i access the same from the ASP.NET code..
Thanks
Sathya
View 2 Replies
View Related
Apr 27, 2004
Hello,
I have a table which has a field called time and it has data like '23/04/2004 9:43:40 AM'
How would i write a query that would retrieve the last hour of data from now().
i've tried this but does not work,
SELECT [time]
FROM table
WHERE ([time] = { fn NOW() } - 60)
Thanks
Goong
View 3 Replies
View Related
Mar 14, 2002
I have a server with two test instances of a data base. I have a query which creates a temp table, inserts 29 rows, perform 4 update queries to add counts and then dumpps out the results. This entire query script runs 1.33 minutes on one instance and 2.5 minutes on the other. On the production server this query now runs in 9 seconds. If I run any one of the test updates individually they execute under 2 seconds, just like the production server.
THe results are repeatable.
All are SQL 7 with all service packs on NT4 sp6. Both test data bases are backups of production from last week. I suspect some kind of caching/buffer problem, but I do not know what to look for. I am not a DBA so I have no idea what role TEMPDB plays may play in this.
Can anyone give us ideas on where to look for the performance difference? Will our impending upgrade to SQL2K solve this problem or make it worse? Any ideas would be appreciated.
View 1 Replies
View Related
Mar 30, 2001
Why is the response time to run a query faster when the output is displayed in grid format as compared to text format?
View 1 Replies
View Related
Sep 13, 2001
Hi,
I am running this query and it is taking over 3 minutes.
"select * from table1 where CONVERT(varchar(10),dated,5) = '13-09-01' "
Table1 has a column called dated which is datetime datatype.
Any suggestions how can i optimize this query?I tried Non-clustered index on Dated column and time came down to less than 3 but still more than 2min.
TIA.
View 4 Replies
View Related
Aug 1, 2003
Is there a way in sql server to find out how much time a sql server took to execute a query.
Thanx in advance.
Regards,
Samir
View 2 Replies
View Related
Aug 19, 2002
This is probably a simple question, but I am relatively new using SQL Queries.
I tried this which gives me half of what I need... SET STATISTICS IO ON
I also need my query to return the run time that it took to run my query.
Can someone help me please?
Thanks!
David
View 2 Replies
View Related
Jul 7, 2006
Aside from indexes, will it help if I use multiple filegroups to improve the time needed to query millions of records?
View 2 Replies
View Related
Jun 11, 2006
I've been baffled over how to do this without using a script... I would like to get the info I need with a single query.
Here's my scenario, the table looks like this (simplified):
ID, TIME
101, 5am
101, 6am
104, 5am
260, 5am
104, 6am
260, 6am
101, 7am
260, 9am
104, 7am
101, 8am
So basically I have a column of identifications and a column of times. They won't necessarily be in order. I would like a query that gives me this:
101, 8am
104, 7am
260, 9am
It would order the IDs ascending, only showing the newest time assigned to that ID in the table.
Thanks in advance for any help :)
View 14 Replies
View Related
Jul 9, 2007
Hey guys and gals,
I'm having a real problem with this query at the moment...
Basically I have to produce a query which will tell me the total number of people employed by the company at any given date and the total salary for all these people.
We have a people table and a career table.
People(unique_identifier, known_as_and_surname, start_date, termination_date ...)
Career(unique_identifier, parent_identifier, career_date, basic_pay ...)
Relationship people.unique_identifier = career.parent_identifier
Employees can be identified like so
SELECT *
FROM people
WHERE start_date <= DateSelected
AND (termination_date > DateSelected
OR termination_date IS NULL)
Passing the selected date to the query is no trouble at all I am just having problems with the point in time side of this.
All and any help is greatly appreciated :)
~George
P.S. SQL Server 2000 ;)
View 14 Replies
View Related
May 20, 2004
We have a query (a few actually) which runs for about 30 secs via Siebel 6 and the same query takes on 1 or 2 secs in Query Analyser, consistently. Naturally this performance problem is causing issues. We're wondering if the App isn't using the same execution plan, or using the indexes or....
It might be worth noting that the query returns 1 or no rows.
(I can add the query and more detail if anyone really, really wants :rolleyes: )
The devlopers have created a VB app which mimmics to app running the query and we've put it through proflier, results..
Duration Reads CPU
Siebel Query 28300 3661280 23984
It seems a high number of reads there, and the result from QA is SO much faster.
Any ideas welcome, thanks.
View 5 Replies
View Related
May 13, 2008
i want to query all my records and how many per date
so
select count(id),date from registrants group by date
but my problem is the date is a date time field so how can i just group it by date but not count the time?
View 2 Replies
View Related
Jun 6, 2008
My table like as follow
Results
Date | Time | Value
---------------------------
4/4/2007 | 0 | 879
4/4/2007 | 5 | 600
4/4/2007 | 10 | 390
4/4/2007 | 15 | 490
4/4/2007 | 20 | 290
...
...
...
4/4/2007 | 100 | 290
4/4/2007 | 105 | 290
4/4/2007 | 110 | 290
...
...
4/4/2007 | 1210 | 290
4/4/2007 | 1215 | 290
Date is DateTime, Time is Integer and Value is Integer
If Time=0, mean 1200 AM
If Time=5, mean 1205 AM
If Time=1210, mean 1210 PM
Let's say Current Date=4 April 2007 and Current Time=1206 AM
I want to display data which is Date>=4 April 2007 and Time>=1206 AM
How to query to get expected result shown as follow
Date | Time | Value
---------------------------
4/4/2007 | 10 | 390
4/4/2007 | 15 | 490
4/4/2007 | 20 | 290
...
...
...
4/4/2007 | 100 | 290
4/4/2007 | 105 | 290
4/4/2007 | 110 | 290
...
...
4/4/2007 | 1210 | 290
4/4/2007 | 1215 | 290
View 12 Replies
View Related
May 7, 2014
I have a query to determine the time range like following
SET @StartDate = CAST (DATEDIFF(d, 0, DATEADD(d, 1 - day(getdate()), getdate()))as datetime)
SET @EndDate = GetDate()
What time range that query set ??
View 3 Replies
View Related