SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 SQL Script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tahseenm
Yak Posting Veteran

USA
62 Posts

Posted - 10/19/2012 :  11:04:57  Show Profile  Reply with Quote
I am trying to retrieve the data from one of the table and not returning anything and no errors. Can somebody help me out on this anything I am putting is wrong. Here is the script below to return field search by a particular date. Thanks

select adddttm,refundamount,moddttm,refundeddttm,refundstatusdttm
from billing.refund where adddttm='08/22/2012'





moetahsen

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 10/19/2012 :  11:33:20  Show Profile  Reply with Quote
First, see if there is any data in the table at all.
SELECT TOP 10 adddttm,
       refundamount,
       moddttm,
       refundeddttm,
       refundstatusdttm
FROM   billing.refund
If there is, try changing the where clause to one of these:
WHERE  adddttm = CAST('08/22/2012' AS DATETIME)
WHERE  CAST(adddttm AS DATETIME) = CAST('08/22/2012' AS DATETIME)
WHERE  adddttm >= CAST('08/22/2012' AS DATETIME) AND addttm < CAST('08/23/2012' AS DATETIME)
If none of that seems to work, post the results of this query:
SELECT DATA_TYPE FROM INFORMATION_SCHEMA.[COLUMNS] c
WHERE c.TABLE_NAME = 'refund' AND c.TABLE_SCHEMA = 'billing'
AND c.COLUMN_NAME = 'adddttm'
Go to Top of Page

tahseenm
Yak Posting Veteran

USA
62 Posts

Posted - 10/19/2012 :  11:58:19  Show Profile  Reply with Quote
WHERE adddttm >= CAST('08/22/2012' AS DATETIME) AND adddttm < CAST('08/23/2012' AS DATETIME)

The above script works and thanks for the time.

moetahsen
Go to Top of Page

tahseenm
Yak Posting Veteran

USA
62 Posts

Posted - 10/19/2012 :  12:01:43  Show Profile  Reply with Quote
Just want to let you know that I check the datatype by using your script and its

datetime

moetahsen
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000