April 15, 2009 at 10:34 am
My bad... looking back on this, I see where you took his suggestion early on. Sorry and thanks for the feedback.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 23, 2018 at 6:33 am
Use below expression
convert(char(8), dateadd(second, [int_datatype_column], ''), 114)
July 24, 2018 at 6:04 am
dalviprasad31 - Monday, July 23, 2018 6:33 AMUse below expression
convert(char(8), dateadd(second, [int_datatype_column], ''), 114)
I know you're a new user.
But you responded to a 9 year old thread in the SQL Server 2005 forum, with a solution that wasn't introduced until SQL Server 2008.
And your solution only works if the number of seconds is less than that in one day. The OP stated this would be OK in his application, but we don't want to post generic solutions that others might read without realizing the limitation.
July 24, 2018 at 12:28 pm
gvoshol 73146 - Tuesday, July 24, 2018 6:04 AMdalviprasad31 - Monday, July 23, 2018 6:33 AMUse below expression
convert(char(8), dateadd(second, [int_datatype_column], ''), 114)I know you're a new user.
But you responded to a 9 year old thread in the SQL Server 2005 forum, with a solution that wasn't introduced until SQL Server 2008.
And your solution only works if the number of seconds is less than that in one day. The OP stated this would be OK in his application, but we don't want to post generic solutions that others might read without realizing the limitation.
Microsoft's documentation has "SQL Server (starting with 2008)" even if it's something that's been available since many many versions ago (convert, dateadd). It's incredibly misleading for just about everyone.
Sue
July 24, 2018 at 12:46 pm
gvoshol 73146 - Tuesday, July 24, 2018 6:04 AMdalviprasad31 - Monday, July 23, 2018 6:33 AMUse below expression
convert(char(8), dateadd(second, [int_datatype_column], ''), 114)I know you're a new user.
But you responded to a 9 year old thread in the SQL Server 2005 forum, with a solution that wasn't introduced until SQL Server 2008.
And your solution only works if the number of seconds is less than that in one day. The OP stated this would be OK in his application, but we don't want to post generic solutions that others might read without realizing the limitation.
There's nothing in that code that hasn't been around since (IIRC) at least SQL Server 6.5. Like Sue said, MS has publishes dates for these things based on what they support and 2008 just went out of support.
I will admit, though, that it doesn't solve the OP's original problem of returning the answer in the MINUTES:SECONDS format.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 16 through 19 (of 19 total)
You must be logged in to reply to this topic. Login to reply