I would like to create a set of new rows in a DB where ID is = to 10,11,12,13,14,15 but all other values are null. This is assuming rows 1 through 9 already exist (in this example). My application will set the first and last row parameters.
Here's my query to create one row but I need a way to loop through rows 10 through 15 until all five rows are created:
@FirstRow int = 10 --will be set by application
,@LastRow int = 15 --will be set by application
,@FileName varchar(100) = NULL
,@CreatedDate date = NULL
,@CreatedBy varchar (50) = NULL
AS
BEGIN
INSERT INTO TABLE(TABLE_ID, FILENAME, CREATED_BY, CREATED_DATE)
VALUES (@FirstRow, @FileName, @CreatedBy, @CreatedDate)
END
The reason I need blank rows is because the application needs to update an existing row in a table. My application will be uploading thousands of documents to rows in a table based on file ID. The application requires that the rows already be inserted. The files are inserted after rows are added. The app then deletes all rows that are null.