I want to add a variable number of records in a table (days)
And I've seen a neat solution for this:
SET @nRecords=DATEDIFF(d,'2009-01-01',getdate())
SET ROWCOUNT @nRecords
INSERT int(identity,0,1) INTO #temp FROM sysobjects a,sysobjects b
SET ROWCOUNT 0
But sadly that doesn't work in a UDF (because the #temp and the SET ROWCOUNT). Any idea how this could be achieved?
At the moment I'm doing it with a WHILE and a table variable, but in terms of performance it's not a good solution.