473,408 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Can't "SELECT" using CREATED_DATE column...help

Ok,
What format is this to where I can't find records (that I know are
there) using this date "2005-09-29 23:58:00".
Here is the SELECT that I use that doesn't work:

SELECT * FROM RMA_HEADER
WHERE CREATED_DATE LIKE '2005-09-29%'

Any help is appreciated.
Thanks,
Trint

Sep 30 '05 #1
3 1892

create table MY_RMA_HEADER (CREATED_DATE datetime)

insert into MY_RMA_HEADER values(getdate())
insert into MY_RMA_HEADER values(dateadd(hh, -1, getdate()))
insert into MY_RMA_HEADER values(dateadd(hh, -2, getdate()))
insert into MY_RMA_HEADER values(dateadd(hh, -3, getdate()))
insert into MY_RMA_HEADER values(dateadd(hh, 1, getdate()))
insert into MY_RMA_HEADER values(dateadd(dd, 1, getdate()))
-- it will fetch data for 30th Sept. 2005
-- I have used 103 for formatting, u can use other as well, the idea is
to truncate time part
SELECT convert(datetime, convert(varchar, CREATED_DATE, 103)) FROM
MY_RMA_HEADER
WHERE convert(datetime, convert(varchar, CREATED_DATE, 103)) =
convert(datetime, '20050930' )

Sep 30 '05 #2
On 30 Sep 2005 04:12:28 -0700, trint wrote:
Ok,
What format is this to where I can't find records (that I know are
there) using this date "2005-09-29 23:58:00".
Here is the SELECT that I use that doesn't work:

SELECT * FROM RMA_HEADER
WHERE CREATED_DATE LIKE '2005-09-29%'

Any help is appreciated.
Thanks,
Trint


Hi Trint,

If the Created_Date is of datetime format, then use

SELECT Col1, Col2, ... -- Don't use SELECT * !!!
FROM RMA_Header
WHERE Created_Date >= '20050929'
AND Created_Date < '20050930'

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Sep 30 '05 #3
>> created_date LIKE '2005-09-29%' <<

Temporal data types are not strings, so you cannot use string functions
on them.

Oct 1 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
16
by: lkrubner | last post by:
Are there any benchmarks on how much an extra, unneeded VARCHAR, CHAR, INT, BIGINT, TEXT or MEDIUMTEXT slows down a database call with MySql? PostGre info would also be useful. I'm trying to...
10
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I...
1
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
8
by: terrorix | last post by:
I also posted this article at: microsoft.public.dotnet.framework.aspnet -------- Hi, I Have this sql select(MS SQL): select a.ID, b.ID from Table as a
2
by: Simon Harvey | last post by:
Hi all, I have to use drop downs in a number of places in my applications. These drop downs are databound but I can't seem to see how to add a new item (eg "Select" or something like that) to...
4
by: Lucky | last post by:
hi guys! Currently i'm facing a bit odd situation. i cant modify my code so i have to make changes in SQL Server. the problem is, i've modified one table by adding new column and now i want...
4
ilikesuresh
by: ilikesuresh | last post by:
hi i have a table (table_Days)that contains columns d0 d1 d2 d3 ...............d30 based on my result i want to either select d0 or d1 or d3 ....d30 at runtime and get the respected value on...
0
by: Steve Kirby | last post by:
You can't ... What you might try is: desc tabe1 This will list the columns in that table. You can select what you want to pull from that way.
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.