Hello,
I am designing a page that will display how many new contacts have been received "today". Currently there are 5 new contacts in the database however, when I count them it returns that there are 0 contacts for today when in fact there are 5 of them. I am using MS SQL Server. The DATE_CREATED DataType is datetime and the defaultvalue is(getdate()). I had done something similar with access (using Date() instead than getdate()) and it worked i just don't understand why it is not working with SQL Server.
Here is the query:
<cfquery name="Today_Contact_Count" datasource="contacts">
SELECT COUNT (CONTACTS.DATE_CREATED) AS TODAY_CONTACTS_COUNT
FROM CONTACTS
WHERE (CONTACTS.DATE_CREATED = (getdate()));
</cfquery>
Thank you,
Grx21
I am designing a page that will display how many new contacts have been received "today". Currently there are 5 new contacts in the database however, when I count them it returns that there are 0 contacts for today when in fact there are 5 of them. I am using MS SQL Server. The DATE_CREATED DataType is datetime and the defaultvalue is(getdate()). I had done something similar with access (using Date() instead than getdate()) and it worked i just don't understand why it is not working with SQL Server.
Here is the query:
<cfquery name="Today_Contact_Count" datasource="contacts">
SELECT COUNT (CONTACTS.DATE_CREATED) AS TODAY_CONTACTS_COUNT
FROM CONTACTS
WHERE (CONTACTS.DATE_CREATED = (getdate()));
</cfquery>
Thank you,
Grx21