Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
hiI am using below query to get the data and time+2 hrsselect dateadd(hour, datediff(hour, 0, getdate()) + 2, 0)getting results as like this2014-10-30 13:00:00.000but i don't need any dashes between dates i mean i am expecting results as shown below20141030 13:00:00.000can anyone help me on query pleaseThanks,Archana
James K
Master Smack Fu Yak Hacker
3873 Posts
Posted - 2014-10-30 : 12:16:34
If you are going to send the results to a client application, send it without any formatting as the datetime data type, and do the formatting in the client application/presentation layer. If you must format in SQL, here is an example: