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

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -