473,569 Members | 2,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting error in mssql database query - Date

3 New Member
Expand|Select|Wrap|Line Numbers
  1. SELECT COUNT(*) AS NumberOfRows FROM a_poll_votes 
  2. WHERE QUESTION_ID='1' 
  3. AND DATE_SUB(CURDATE(),INTERVAL 0 DAY) <= DATE_FORMAT(DT, '%Y-%m-%d') 
  4. AND IP='111.111.1.1'
  5.  
I think I am making mistake here:

DATE_SUB(CURDAT E(),INTERVAL 0 DAY) <= DATE_FORMAT(DT, '%Y-%m-%d')

Can anbody plz help me.

This needs to be in asp and mssql

Thanks
Apr 17 '11 #1
1 1964
code green
1,726 Recognized Expert Top Contributor
Well, you haven't posted the error, but this does look odd
Expand|Select|Wrap|Line Numbers
  1. DATE_SUB(CURDATE(),INTERVAL 0 DAY) <= DATE_FORMAT(DT, '%Y-%m-%d')
This is not how date comparisons are done in SQL.
What filter are you tying to apply here, and is DT a DATETIME data type field. Hopefuly yes
Apr 18 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5345
by: Manuel | last post by:
Hello, I try to export a mssql database into a csv-file. I tried this with asp, but it doesn't work. <% Dim objConn Dim csv_path
8
9995
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/WebApplication1'. 'HTTP/1.1 500...
0
1081
by: Rookie Card | last post by:
Issue - Reformating the Dates in ASP.NET from a MSSQL Database that has <NULL> values in a SmallDateTime Field to read "Dec 8, 2000" instead of "12/8/2000 12:00:00 AM" (As you might already know "DateTime.Parse" will throw an exception when it comes accross a <NULL> date value so some logic has to be written.
9
5827
by: Advo | last post by:
Im having major problems trying to connect to a mssql database thats hosted on our server. I've got the ip, username, password and database name, yet no matter what i try, I cant seem to connect. I've trawled the net for hours looking for code, has anyone got any that definately works, or just a simple way I can check the connection. ...
1
7845
by: jesmi | last post by:
my code is: U]employee.cfm <html> <head> <title>Employee List</title> </head> <body> <h1>Employee List</h1>
7
1819
by: ScottieFromNM | last post by:
I am trying to post values into a mssql database and having some trouble. I create a detail_id in the first query and want to pass this detail_id to several other queries to insert into several other tables. It creates the detail_id in the first table, but doesn't pass it on, when I try to retrieve it. Here is my code: ...
19
6004
by: phill86 | last post by:
Hi I am re-posting this thread because it has become very confusing and I have got some way to solving the problem so it is a slightly different question from the initial thread. here is the original tread http://bytes.com/topic/access/answers/872005-query-date-range Just to clarify what I am trying to achieve....
6
13941
by: sarah2855 | last post by:
Hello everyone, I'm running a Make-Table Query in Access. They was working fine up intill an hour ago and suddenly now that I'm running the query , I keep getting this error message: Can not open Database 'Query 1'. This may not be a database that your application recognizes, or the file maybe corrupted. And if I close access and...
1
1235
by: NareshN | last post by:
Hi, I am getting error because of this line in stored procedure.How to enclose string value. Count(Case When Totalhours<='25:0' Then EmpNo end) as Less. 25:0 is varchar datatype so i am enclosing in quotations. ALTER PROCEDURE .(@date1 DATETIME, @date2 DATETIME, @date3 DATETIME, @date4 DATETIME) AS DECLARE @query VARCHAR(MAX)
3
2886
by: tanishka singh | last post by:
How do you convert string from database into date in asp.net? Dim output = (From tlb In obj.SelectRecordAll_SalesInquiryRegister _ Join tlb1 In LatestPOs On tlb.SIR_OfferNo Equals tlb1.OfferNo _ And tlb.SIR_AlterationNo Equals tlb1.PORevNo _ Order By tlb.SIR_Flag _ ...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6287
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.