0

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'.
6
  • 1
    Simply 0x00 not '0x00' Commented Feb 3, 2014 at 13:09
  • 1
    Remove the quotes, 0x indicates a binary literal Commented Feb 3, 2014 at 13:09
  • @PeterRing when i did your soluton, i got the error that i put in the questoni Commented Feb 3, 2014 at 13:10
  • @AlexK. when i did your solution, i got the error that i put in the question, Commented Feb 3, 2014 at 13:10
  • 2
    Single quotes here -> ("1", "1", "1", "1", 0x00) Commented Feb 3, 2014 at 13:12

2 Answers 2

3

Dont need ''.

INSERT INTO dbo.[User]
(GSM, SIM, [Password], SessionID, [type])
VALUES
('1', '1', '1', '1', 0x00)
Sign up to request clarification or add additional context in comments.

1 Comment

+1 to you, i will accept your answer after 8 minutes
0

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
    )

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.