question

AndresPerez-5950 avatar image
0 Votes"
AndresPerez-5950 asked ChristopherOrtiz-9983 answered

Insertar imagenes en sql

Como puedo insetar imagenes por codigo en sql

insert into Cliente (
ID_DOCU_CLIENTE, NOMBRE, APELLIDO, DIRECCION , TELEFONO, EMAIL, CERTIFICADO)
Select 1032116, 'Carlos Mario', 'Castañeda', 'Cr 45 # 58 -03', 7683420, 'cmcastañeda@mail.com', BulkColumn FROM Openrowset(
Bulk 'C:\ImagenFichero2.bmp', Single_Blob)

Tengo este codigo y me genera error 145540-imagen.png


sql-server-general
imagen.png (4.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ChristopherOrtiz-9983 avatar image
0 Votes"
ChristopherOrtiz-9983 answered

Hi!
The error occurred because you forgot to include the correlation name.
To fix this problem, all we need to do is provide a correlation name (also known as a range variable or alias).

Example:
SELECT BulkColumn FROM OPENROWSET (
BULK '/var/opt/mssql/bak/pets.json',
SINGLE_CLOB
) AS MyAlias;

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.