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 |
snufse
Constraint Violating Yak Guru
469 Posts |
Posted - 2010-08-05 : 14:47:09
|
How can I easily split year = Year(GetDate()) into 2 integers,Example: for year 2010 I need value 20 and value 10 split up |
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-08-05 : 14:48:41
|
[code]SELECT LEFT(YEAR(GETDATE()),2),RIGHT(YEAR(GETDATE()),2)[/code] |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2010-08-05 : 15:31:37
|
[code]select YearLeft2 = year(getdate())/100, YearRight2 = year(getdate())%100[/code]Results:[code]YearLeft2 YearRight2 ----------- ----------- 20 10 [/code]CODO ERGO SUM |
 |
|
|
|
|