sql server - Inserting n number of records with T-SQL -
I want to add a variable number of records in the table (day)
and I have a A clean solution was seen:
SET @ nRecords = DATEDIFF (d, '2009-01-01', getdate ()) SET ROWCOUNT @ntRecords INSERT INSERT (ID, 0,1) in sysobjects A, sysobjects b SET ROWCOUNT 0
Sadly, the UDF does not work in (because #TripP and SET Rowet). How can any ideas be obtained?
At the moment I am doing it with WHILE and a table variable, but in terms of performance it is not a good solution.
If you are using SQL 2005 or newer, you can get a list of dates or numbers You can use the recursive CTE ...
Comments
Post a Comment