jasonsalas
IS-IT--Management
I'd like to run a FOR statement, such that it seeds a series of records with a value, and so that the logic resembles the following JavaScript/C# loop for 99 records:
for(int i=0;i<100;i++)
{
INSERT INTO Table (EmpID,Department) VALUES (i,'2')
}
This is a one-time use thing just to instantiate values in a new table, so I *could* get away with copying-and-pasting the T-SQL statement and manually incrementing the EmpID, but that would defeat the purpose of programming.
Is there a way to do this in T-SQL?
for(int i=0;i<100;i++)
{
INSERT INTO Table (EmpID,Department) VALUES (i,'2')
}
This is a one-time use thing just to instantiate values in a new table, so I *could* get away with copying-and-pasting the T-SQL statement and manually incrementing the EmpID, but that would defeat the purpose of programming.
Is there a way to do this in T-SQL?