I’m a newbie in Stored Procedures in SQL Server 2005. Let’s say we have a table with these columns: Id (GUID)
, UserId (string)
, DayOfYear (int)
, Score (int)
.
I need a SP with one input (inputDayOfYear
) which copy last day (inputDayOfYear=10 => last day DayOfYear=9) data with new Id
but old UserId
and Score
, and current DayOfYear
(th input parameter) to new rows.
- One important thing is to ignore
those records that have data of
DayOfYear
same asinputDayOfYear
. - Performance is also very important
here; there are may be over 1000 rows
for each
DayOfYear
. - Return value is not necessary but number of new rows would be fine.
I’ll be appreciated if you introduce me to some good resources to learn SP, too.