SQL Server Incremental Years Value
| by RANA | May 17, 2008
I am unable to find something good and fast where without involving master database years value in the sql server. I found below query but I dont wanted to involve master databaseSELECT TOP 11000 âequates to more than 30 years of dates
IDENTITY(INT,1,1) AS N
INTO dbo.Tally
FROM Master.dbo.SysColumns sc1,
Master.dbo.SysColumns sc2
Here is something i made simple and fast.
DECLARE @TILL INT â define your end year value I am taking till 2008 + 2 = 2010
SET @TILL = YEAR(GETDATE())+2
DECLARE @FIRSTVALUE INT
SET @FIRSTVALUE=2001 - declaring first value
CREATE TABLE #TEMP
( .......
http://blog.joggee.com/?p=165
The author of Blog.Joggee is the same person of the Rana Blog in the codeproject.wordpress.com.The reason why this new blog was created because Rana wanted to share more diverse range of services such as the latest technology, variation of ideas and universal advice in more user friendly and customizable way.Join and become a part of an international community dedicated to excellence, service and knowledge creation.
IDENTITY(INT,1,1) AS N
INTO dbo.Tally
FROM Master.dbo.SysColumns sc1,
Master.dbo.SysColumns sc2
Here is something i made simple and fast.
DECLARE @TILL INT â define your end year value I am taking till 2008 + 2 = 2010
SET @TILL = YEAR(GETDATE())+2
DECLARE @FIRSTVALUE INT
SET @FIRSTVALUE=2001 - declaring first value
CREATE TABLE #TEMP
( .......
http://blog.joggee.com/?p=165
The author of Blog.Joggee is the same person of the Rana Blog in the codeproject.wordpress.com.The reason why this new blog was created because Rana wanted to share more diverse range of services such as the latest technology, variation of ideas and universal advice in more user friendly and customizable way.Join and become a part of an international community dedicated to excellence, service and knowledge creation.
Article Source: http://www.articleset.com

You are welcome to publish or reprint this article free of charge, provided:
- you include the entire article, unchanged, including the "About The Author" box
- all hyperlinks remain active, including the bottom ArticleSet.com link (does not apply to print publications)
- you agree not to hold the authors nor ArticleSet.com liable for any loss profits, expenses, or any other damages resulting from the use or misuse of articles published on this website