Tuesday, June 14, 2011

T-SQL Convert string to datetime

This is the kind of stuff you don't wanna waste time on - and yet ...

DECLARE @test varchar(10)
SET @test = '12/31/2011'

DECLARE @test_date datetime
SET @test_date = CONVERT(datetime, @test, 101)