В основном мне нужно вставить результат запроса в таблицу.
AS
BEGIN
INSERT INTO [dbo].[Film]([Title], [ReleaseYear], [MainGenreName], [SecondaryGenreName], [Rating], [Length], [Summary], [DateAdded], [RowNumber], [CoverImageFile], [FilmFile])
VALUES(@Title, @ReleaseYear, @MainGenreName, @SecondaryGenreName, @Rating, @Length, @Summary, @DateAdded, @RowNumber, @CoverImageFile, @FilmFile)
RETURN SCOPE_IDENTITY()
'Determines # of rows, and sets RowNumber as that #'
SET @RowNumber = (SELECT COUNT(*) FROM Film;
END
GO
GO
INSERT INTO [dbo].[Film]([Title], [ReleaseYear], [MainGenreName], [SecondaryGenreName], [Rating], [Length], [Summary], [DateAdded], [RowNumber], [CoverImageFile], [FilmFile])
VALUES ('Shaun of the Dead', '2004', 'Comedy', 'Horror', 'R', '2:00', 'Summary', '10/16/2019', @RowNumber,
(SELECT * FROM OPENROWSET(BULK N'C:\Users\Dave Gassmann\OneDrive\NotFlix\CoverImages\SOTD.jpg', SINGLE_BLOB) as Image),
(SELECT * FROM OPENROWSET(BULK N'C:\Users\Dave Gassmann\OneDrive\NotFlix\Trailers\SOTD.mp4', SINGLE_BLOB) as Film))