Int to Date in SQL SERVER 2000 -


how convert int column ,birthdate( sample value 20090301) date column in format(01/03/2009) sql server 2000

i trying convert thing below

select * tabl  cast(dob datetime)>='01/03/2009' gives error  msg 8115, level 16, state 2, line 1 arithmetic overflow error converting expression data type datetime. 

sql server doesn't allow cast int -> datetime directly, if you're sure can cast nvarchar first , cast date. question here's example

declare @test int = 20090301 select convert(datetime, cast(@test nvarchar), 112) 

112 format mentioned, here's list of possible formats convert function.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -