Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rohit_k888
Starting Member
4 Posts |
Posted - 2014-04-14 : 02:02:49
|
Suppose there is a relation schema R(name,DOB)'name' is in char data type and DOB is in date i.e. contain values such as '04-APR-1988'.My query is to find the names from the table R whose DOB is after say '26-Jan-1985'. How do I get this with the help of a sql query? |
|
VeeranjaneyuluAnnapureddy
Posting Yak Master
169 Posts |
Posted - 2014-04-14 : 02:19:12
|
declare @R table(name char(10),DOB varchar(30))insert @Rselect 'your name','04-APR-1988'select name From @R where CONVERT(DATE,DOB) > CONVERT(DATE,'26-Jan-1985')Veera |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2014-04-14 : 05:15:12
|
If DOB is of DATE or DATETIME datatype, you can just doselect name From R where DOB > '19850126'MadhivananFailing to plan is Planning to fail |
|
|
|
|
|