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 |
|
dan_coder
Starting Member
20 Posts |
Posted - 2006-07-21 : 08:34:10
|
| Hi guysThis is my problem: I have a table with a date field. I have to get month of this field using Month function, but result from jannuary to september is only one bytes long (1,2,3...10). How to extract two bytes (01,02,03...09)?Thanks |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-21 : 08:38:38
|
| select right('00' + convert(varchar(2),month(dte)),2)orselect right(convert(varchar(6),dte,112),2)==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-07-21 : 08:41:44
|
| Check the "Convert", "Datepart" & "Replicate" in Books On LineSrinika |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-07-21 : 09:12:31
|
Orselect right(month(dte) + 100, 2) KH |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2006-07-21 : 09:26:04
|
| OrWhy are you worrying about how many BITS it is? Sounds like a presentation problem, and should be handled on the FRONT END.Help us help YOU!Read this blog entry for more details: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx*need more coffee*SELECT * FROM Users WHERE CLUE > 0(0 row(s) affected) |
 |
|
|
|
|
|
|
|