December 30, 2003 at 8:52 am
I'm trying to display a date format using YYYYMMDD (20030830) instead of 2003-08-30 00:00:00. Any ideas?
December 30, 2003 at 8:58 am
Try something like:
select replace(convert(char(10),getdate(),120),'-','')
Gregory A. Larsen, DBA
Contributor to 'The Best of SQLServerCentral.com 2002' book. Get a copy here: http://www.sqlservercentral.com/bestof/
Need SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
Gregory A. Larsen, MVP
December 30, 2003 at 9:05 am
select Replace(Substring('2003-08-30 00:00:00',1,10),'-','')
December 30, 2003 at 9:09 am
Here's a shameless plug for a script I submitted...
http://www.sqlservercentral.com/scripts/contributions/1009.asp
Once you understand the BITs, all the pieces come together
December 30, 2003 at 9:40 am
Why not just use CONVERT with Type 112 (ISO)?
SELECT CONVERT(char(8),GETDATE(),112)
--Jonathan
--Jonathan
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply