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 |
|
Gopher
Yak Posting Veteran
83 Posts |
Posted - 2006-05-05 : 04:00:50
|
| Hi AllThis is possibly a simple problem to solve but I am fing it a little difficult.I am trying to create an T-SQL query that returns the current year and month e.g. '200604'. I have been looking at the datepart function and so far I can getdatepart(yyyy,GetDate()) which returns 2006datepart(mm,GetDate()) which returns 4 (i need '04')I need them combined to produce '200604' any ideas? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-05-05 : 04:02:38
|
select convert(varchar(6), getdate(), 112) KH |
 |
|
|
Gopher
Yak Posting Veteran
83 Posts |
Posted - 2006-05-05 : 04:04:08
|
| Awsome! Thanks khtan |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-05-05 : 04:15:44
|
| Also, use front end application to format the dateMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|