user2059935
user2059935

Reputation: 971

sql insert binary data

I am using sql server r2 2008

i want to insert a binary data using a query

i tried this

INSERT INTO dbo.[User]
(GSM, SIM, [Password], SessionID, [type])
VALUES
("1", "1", "1", "1", '0x00')

but i got an error in the "0x00"

what should i do please?

This is the error

Msg 207, Level 16, State 1, Line 1
Invalid column name '1'.
Msg 207, Level 16, State 1, Line 1
Invalid column name '1'.
Msg 207, Level 16, State 1, Line 1
Invalid column name '1'.
Msg 207, Level 16, State 1, Line 1
Invalid column name '1'.

Upvotes: 0

Views: 3110

Answers (2)

PeterRing
PeterRing

Reputation: 1797

Dont need ''.

INSERT INTO dbo.[User]
(GSM, SIM, [Password], SessionID, [type])
VALUES
('1', '1', '1', '1', 0x00)

Upvotes: 3

pankeel
pankeel

Reputation: 1148

like this..

INSERT INTO
    [MyDatabase].[dbo].[tblPicture]
    ( Name, Branch, Age, Image )

    (
        SELECT 'a','amd',1,*
        FROM OPENROWSET
            (BULK N'c:\image.jpg', SINGLE_BLOB)
        AS Picture
    )

Upvotes: 0

Related Questions