January 18, 2019 at 10:09 am
I would hope that nobody is actually still using SQL Server 2005. In 2008 (also no longer supported) the time datatype was introduced.
This makes this type of thing so simple.
select convert(time, getdate())
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
January 18, 2019 at 11:24 am
Sean Lange - Friday, January 18, 2019 10:09 AMI would hope that nobody is actually still using SQL Server 2005. In 2008 (also no longer supported) the time datatype was introduced.This makes this type of thing so simple.
select convert(time, getdate())
I agree, but I would not be surprised if some where out there in the wild there are still people and organizations using not only SQL Server 2005 but 2000, 7.5, 7.0, 6.5, 6.0. If they are out there, they still need our help.
January 18, 2019 at 1:34 pm
Lynn Pettis - Friday, January 18, 2019 11:24 AMSean Lange - Friday, January 18, 2019 10:09 AMI would hope that nobody is actually still using SQL Server 2005. In 2008 (also no longer supported) the time datatype was introduced.This makes this type of thing so simple.
select convert(time, getdate())I agree, but I would not be surprised if some where out there in the wild there are still people and organizations using not only SQL Server 2005 but 2000, 7.5, 7.0, 6.5, 6.0. If they are out there, they still need our help.
Indeed. But at the same time I would hate for somebody using 2017 to stumble across and use a now seriously out of date (pun intended) method. 🙂
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
January 18, 2019 at 5:41 pm
Sean Lange - Friday, January 18, 2019 1:34 PMLynn Pettis - Friday, January 18, 2019 11:24 AMSean Lange - Friday, January 18, 2019 10:09 AMI would hope that nobody is actually still using SQL Server 2005. In 2008 (also no longer supported) the time datatype was introduced.This makes this type of thing so simple.
select convert(time, getdate())I agree, but I would not be surprised if some where out there in the wild there are still people and organizations using not only SQL Server 2005 but 2000, 7.5, 7.0, 6.5, 6.0. If they are out there, they still need our help.
Indeed. But at the same time I would hate for somebody using 2017 to stumble across and use a now seriously out of date (pun intended) method. 🙂
Since it's for display purposes, what's wrong with using CONVERT in 2017?
--Jeff Moden
Change is inevitable... Change for the better is not.
January 19, 2019 at 3:02 pm
Lynn Pettis - Friday, January 18, 2019 9:38 AMLempster - Friday, January 18, 2019 2:26 AMReally? What about this:
SELECT CONVERT(varchar(10),GETDATE(),108);
@Lynn Pettis: I did say that were probably other ways to achieve what the OP wanted!
It was likely the words "you'll need to" that Lynn is taking exception to, I was thinking the same thing as he. 😀 It's things like this that have made me change my posting style a bit over the last couple of decades just to keep people from becoming incensed by words whether they're right or wrong to do so. For example, I'd have written "Here's one way to do it...".
Now, what would really be cool would be if you two guys got together and did a million row test on your machines and published your results and the code on this thread so other people can do the same. :laugh:
--Jeff Moden
Change is inevitable... Change for the better is not.
January 20, 2019 at 2:31 am
Lynn Pettis - Friday, January 18, 2019 9:38 AM
It was likely the words "you'll need to" that Lynn is taking exception to, I was thinking the same thing as he. 😀 It's things like this that have made me change my posting style a bit over the last couple of decades just to keep people from becoming incensed by words whether they're right or wrong to do so. For example, I'd have written "Here's one way to do it...".
Now, what would really be cool would be if you two guys got together and did a million row test on your machines and published your results and the code on this thread so other people can do the same. :laugh:
Fair point Jeff. If I find the time to do the test you suggest, I will.
Lempster
January 20, 2019 at 8:02 am
Lempster - Saturday, January 19, 2019 1:43 AMLynn Pettis - Friday, January 18, 2019 9:38 AM
It was likely the words "you'll need to" that Lynn is taking exception to, I was thinking the same thing as he. 😀 It's things like this that have made me change my posting style a bit over the last couple of decades just to keep people from becoming incensed by words whether they're right or wrong to do so. For example, I'd have written "Here's one way to do it...".
Now, what would really be cool would be if you two guys got together and did a million row test on your machines and published your results and the code on this thread so other people can do the same. :laugh:
Fair point Jeff. If I find the time to do the test you suggest, I will.
Lempster
Thank you, good Sir, for taking all of that the right way. Both of you have your hearts in the right place.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 8 posts - 16 through 22 (of 22 total)
You must be logged in to reply to this topic. Login to reply