Obfuscated
Obfuscated

Reputation: 321

Get a date when a string is attached to it

I have a list of dates with a working crew added to them...

07/19/15254A
07/21/15254B
07/22/15254A
07/22/15254B
etc...

What I need to do is be able to enter just a date to search by/for such as 07/20/15 and return the first date from the list above that matches or is the next available date. This 07/20/15 should return 07/21/15254B.

Upvotes: 0

Views: 37

Answers (1)

Mukesh Kalgude
Mukesh Kalgude

Reputation: 4844

Try this query

select * from tablename where convert(datetime,left(Columnname,8))=CONVERT(datetime,'15/07/20',11)

Upvotes: 1

Related Questions