472,128 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,128 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 991
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 leo001 | last post: by

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.