473,404 Members | 2,137 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,404 software developers and data experts.

Probs in DateTime query

1)create table emp(empid int,dob datetime)
insert into emp values(1,'12/12/1950')
insert into emp values(2,'12/12/1952')
insert into emp values(3,'12/12/1948')
insert into emp values(4,'12/09/1950')
select * from emp

I want to retrieve the those empid's of those employees who were born on year 1950.

2) I want to ask that when we insert only date,time is also inserted by default 00.00.00.000. If i want that time is not insetde, what to do??
Mar 20 '08 #1
1 1025
ck9663
2,878 Expert 2GB
1)create table emp(empid int,dob datetime)
insert into emp values(1,'12/12/1950')
insert into emp values(2,'12/12/1952')
insert into emp values(3,'12/12/1948')
insert into emp values(4,'12/09/1950')
select * from emp

I want to retrieve the those empid's of those employees who were born on year 1950.

2) I want to ask that when we insert only date,time is also inserted by default 00.00.00.000. If i want that time is not insetde, what to do??

1. Use the DATEPART function.

2. By default it will be inserted. If you want it remove on display, use the CONVERT function.

-- CK
Mar 20 '08 #2

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

Similar topics

2
by: JTWhaler | last post by:
I'm looking for an efficient t-sql script to loop through all user tables in a db and determine/print the value of each row having a datetime field (including cases where there are multiple...
1
by: antao | last post by:
I'm keeping in the database a log of all the sessions for my application. I'm trying to write a stored procedure that returns all the sessions that; the login contains a certain string, loggedin...
4
by: Vishal | last post by:
Hello, I am trying to convert a date from a string like this: Dim dtDate As DateTime = Convert.ToDateTime("Sun, 07 Nov 2004 14:05:04 +0200") Response.Write(dtDate.ToString("dd MMM yyyy")) ...
2
by: rdraider | last post by:
Hi, We have a lame app that uses 2 datetime(8) fields, 1 stores the date, the other the time. example query: select aud_dt, aud_tm from orders results: aud_dt ...
6
by: rn5a | last post by:
I am inserting records in a MS-Access database table. The data type of one of the columns named *OrderDate* in the DB table is Date/Time. This is the SQL query I am using to insert the records in...
3
by: Mukesh | last post by:
HI all I have created a user ctrl for user info. On which i have used some asp ctrls, .net Ajax (Atlas) Ctrls and validation as described below Name TxtBox1(RequiedFieldValidator,...
3
by: Jassim Rahma | last post by:
Hi, I want to know how can i query from sql server date field without the time? i mean if i have the following dates: 8/22/2007 12:00:00 AM 8/22/2007 12:23:00 AM 8/22/2007 04:15:00 PM and...
5
by: Mike | last post by:
Hi, I use MS SQL Express and VS 2005 c#, win application. I would like to select value rom DateTimePicker and list all values for selected date within GridView. I have method as follows: ...
10
by: SenileOwl | last post by:
I'm working in vb.net. I'm trying to create a query for a table adapter that will filter data. The query is SELECT CommitteeId, CommitteePostion FROM MemberIndexApp WHERE ((UserName = @UserName)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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...
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
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,...
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...

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.