I’m developing a project in which I have to use a database to store data from a cinema. One of the tables stores some movies data(movie name, duration actors, etc) and it has a image column; I left it null so that I could take care of the login first and then inserted the ovies but didn’t insert the image, and now when I try to insert the image it gives this error.
The multi-part identifier “Filmes.Titulo_Filme” could not be bound.
The code I’m using to insert the image is this:
insert into Filmes (Imagem) select * from OPENROWSET(BULK N'F:RCRC8ProjectoShikiHD_ASPShikiHD_ASPImagesbohemianrhapsody.jpeg', SINGLE_BLOB) as image where Filmes.Titulo_Filme = 'Bohemian Rhapsody'
Any help is much appreciated.
EDIT: I tried to update the column since I already had all the other columns filled and it still didn’t work, but now it gives another error.
String or binary data would be truncated.
The statement has been terminated.
The code for the update:
update Filmes set Imagem = (select * from OPENROWSET(BULK N'F:RCRC8ProjectoShikiHD_ASPShikiHD_ASPImagesbohemianrhapsody.jpeg', SINGLE_BLOB) as image) where Filmes.Titulo_Filme = 'Bohemian Rhapsody'
Advertisement
Answer
This is your query:
insert into Filmes (Imagem) select * from OPENROWSET(BULK N'F:RCRC8ProjectoShikiHD_ASPShikiHD_ASPImagesbohemianrhapsody.jpeg', SINGLE_BLOB) as image where Filmes.Titulo_Filme = 'Bohemian Rhapsody'
Filmes
is not defined. image
is. So perhaps you mean:
insert into Filmes (Imagem) select imagen from OPENROWSET(BULK N'F:RCRC8ProjectoShikiHD_ASPShikiHD_ASPImagesbohemianrhapsody.jpeg', SINGLE_BLOB) as image where image.Titulo_Filme = 'Bohemian Rhapsody';
Or perhaps you really want an update
:
update filmes set imagem = i.image from OPENROWSET(BULK N'F:RCRC8ProjectoShikiHD_ASPShikiHD_ASPImagesbohemianrhapsody.jpeg', SINGLE_BLOB) as i(image) where filmes.Titulo_Filme = 'Bohemian Rhapsody';