TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Prakash Mondal
NA
288
210.7k
How to get values between two dates?
Mar 7 2018 3:21 AM
I create a database table.
EmployeeTable: that is employee_tb
emp_no
nvarchar(50)
emp_name
nvarchar(50)
dept
nvarchar(50)
emp_doj
nvarchar(50)
emp_dor
nvarchar(50)
After Inserted Values:
emp_no
emp_name
dept
emp_doj
emp_dor
E-1001
priya prakash
CHEM
12-Feb-1980
10-Mar-2018
E-1002
riya prakash
MATH
24-Jan-1990
25-Feb-2018
E-1003
jiya prakash
ENG
05-Dec-1995
13-Feb-2018
E-1004
diya prakash
PHYS
19-May-1995
01-Apr-2018
E-1005
piya prakash
COM
10-Jun-1999
24-Jan-2018
My Output Will Happen:
I want to display result that is those employee who has retirement date from 01-Jan-2018 to 28-Feb-2018 with asc order
emp_no
emp_name
dept
emp_doj
emp_dor
E-1005
piya prakash
COM
10-Jun-1999
24-Jan-2018
E-1003
jiya prakash
ENG
05-Dec-1995
13-Feb-2018
E-1002
riya prakash
MATH
24-Jan-1990
25-Feb-2018
I use this sql:
SELECT * FROM employee_tb WHERE cast(emp_dor as date) between '01-Jan-2018' AND '28-Feb-2018' order by emp_dor asc
but error.
Please help me.
Reply
Answers (
5
)
Regarding datatypes in SqlServer
Error throw on table opening time