469,603 Members | 2,069 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,603 developers. It's quick & easy.

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 961
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

Post your reply

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

Similar topics

2 posts views Thread by JTWhaler | last post: by
4 posts views Thread by Vishal | last post: by
6 posts views Thread by rn5a | last post: by
3 posts views Thread by Mukesh | last post: by
3 posts views Thread by Jassim Rahma | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.