By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,364 Members | 1,268 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,364 IT Pros & Developers. It's quick & easy.

Probs in DateTime query

P: 95
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
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
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.