I have a table with datekey column values(20120728,20120728...) in format of yyyymmdd
as int type, I need to make them into date format of mm/dd/yyyy
while writing select statement.
DECLARE @date int;
SET @date = 20131107
SELECT CONVERT(date, CONVERT(varchar(8), @date), 112)
Please Try This
DECLARE @date int;
SET @date = 20120728
SELECT CONVERT(varchar(20), CONVERT(date, CONVERT(varchar(8), @date), 112),110)as datetime
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With