I need to populate a table with a row for each month between a range of dates.
Given one StartDate and one EndDate insert a row for each month between StartDate and EndDate (inclusive).
E.g.
StartDate = 1/1/2011, EndDate = 12/1/2011 would add 12 rows to the table.
StartDate = 1/1/2011, EndDate = 12/1/2014 would add 48 rows to the table.
Dim cnn As SqlClient.SqlConnection
Dim rst as ?????
cnn = _
DirectCast(Dts.Connections("server.DB.conmgr").AcquireConnection(Dts.Transaction), _
SqlClient.SqlConnection)
intPrd = dateDiff(month, StartDate, EndDate)
for intCnt = 0 to intPrd
with rst
.AddNew
??? = dateadd(month, intPrd, StartDate)
.update
Next intPrd