Convert varchar to date format

I have a field which is currently varchar(42) and holds data in this format:  2016-09-30 @ 1:33 PM

I need to remove the space before the @ and anything after that space, including the @ so that only the date remains.
Then if possible use a script to conver the: yyyy/mm/dd into a date format

I am using MS SQL 2012
LVL 1
AleksAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
Try this:
convert(date, substring(some_column,1,charindex(' ',some_column)),102)
0
AleksAuthor Commented:
Msg 156, Level 15, State 1, Line 10
Incorrect syntax near the keyword 'convert'.

I want to remove the text after @ including the space before it, that would be more helpful first.
0
AleksAuthor Commented:
Also, the script above doesn't indicate which table.
0
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Of course you need to write something like
select convert(date, substring(some_column,1,charindex(' ',some_column)),102) from some_table

Open in new window

to integrate it into your current select, using your real column and table name.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AleksAuthor Commented:
Thanks to both
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.