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 |
|
cwtriguns2002
Constraint Violating Yak Guru
272 Posts |
Posted - 2007-04-18 : 05:37:34
|
| Hi everyone. having a @date = '2007/04/01'.How could I get the month 04? and my expected result is the actual 04.Thanks.-Ron-"If you can only access one site on the Internet, make it SQLTeam!" |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-18 : 05:39:49
|
| [code]Declare @date datetimeset @date = '2007/04/01'Select Month(@date)[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-18 : 05:45:45
|
| select @date, convert(varchar(2), @date, 103)Peter LarssonHelsingborg, Sweden |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-18 : 05:51:10
|
quote: Originally posted by Peso select @date, convert(varchar(2), @date, 103101)Peter LarssonHelsingborg, Sweden
Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-18 : 05:55:17
|
Ah! Thanks Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|