locked
Inserting data into table RRS feed

  • Question

  • Hi ALl,

    Am getting error while am inserting data into table column. Column datatype is varchar[50].

    While inserting data like--> Matthew D'Andrea. Kindly help me how to insert 

    Regards,

    Venkat.

    Tuesday, June 11, 2013 2:58 PM

Answers

  • Hi,

    It's not a double quote ["], you'll just have to type two apostrophes ['][']

    Text will be shown as expected : Matthew d'Andrea.


    Sebastian Sajaroff Senior DBA Pharmacies Jean Coutu

    • Marked as answer by Ven Raja Tuesday, June 11, 2013 3:22 PM
    Tuesday, June 11, 2013 3:14 PM

All replies

  • Hi,

    Apostrophes should be escaped as double apostrophes.

    INSERT INTO MyTable (FullName) VALUES ('Matthew D''Andrea')


    Sebastian Sajaroff Senior DBA Pharmacies Jean Coutu

    Tuesday, June 11, 2013 3:02 PM
  • Thanks for reply but am should not get  double quotes in between. I need only single qoute in Matthew D''Andrea. Is it possible 
    Tuesday, June 11, 2013 3:11 PM
  • Hi,

    It's not a double quote ["], you'll just have to type two apostrophes ['][']

    Text will be shown as expected : Matthew d'Andrea.


    Sebastian Sajaroff Senior DBA Pharmacies Jean Coutu

    • Marked as answer by Ven Raja Tuesday, June 11, 2013 3:22 PM
    Tuesday, June 11, 2013 3:14 PM
  • I have checked below code

    declare @a varchar(50)= ('Matthew D''Andrea')
    select @a

    and result is - Matthew D'Andrea

    so you can go as suggested by Sabastian it will work

    INSERT INTO MyTable (FullName) VALUES ('Matthew D''Andrea')

    Friday, June 14, 2013 1:33 PM