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.
Author |
Topic |
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2008-08-04 : 10:45:56
|
When i use this function , i get the firstday of previousmonthDATEADD(mm,DATEDIFF(mm,0,dateadd(mm,-0-datepart(day,0),getdate())),0) AS [First Day Prio Month]but i get the date in this format 2008-07-01 but i want the date inthis format 20080701(without hyphens).how can i get that?Thanks in advance |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-04 : 11:00:19
|
quote: Originally posted by akpaga When i use this function , i get the firstday of previousmonthDATEADD(mm,DATEDIFF(mm,0,dateadd(mm,-0-datepart(day,0),getdate())),0) AS [First Day Prio Month]but i get the date in this format 2008-07-01 but i want the date inthis format 20080701(without hyphens).how can i get that?Thanks in advance
Where do you want to show converted dates?MadhivananFailing to plan is Planning to fail |
 |
|
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2008-08-04 : 11:04:31
|
in a select statement |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-04 : 14:08:16
|
do it in your front end application if you can else useSELECT REPLACE(CONVERT(varchar(11),datefield,121),'-','') |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-05 : 02:58:19
|
quote: Originally posted by visakh16 do it in your front end application if you can else useSELECT REPLACE(CONVERT(varchar(11),datefield,121),'-','')
SELECT CONVERT(varchar(8),getdate(),112)MadhivananFailing to plan is Planning to fail |
 |
|
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2008-08-05 : 12:44:32
|
Thanks -- madhivanan and visakh16 |
 |
|
|
|
|
|
|