Transact-SQL Q&A

  1. How to handle "'" symbols when making inserts to SQL-table?:

    Details

    Line:

    INSERT INTO <tablename> VALUES ( 'Singer Name:', 'Shinned O'Connor' )

    gives an error because of "'" symbol in name of a singer. However modified statement

    INSERT INTO <tablename> VALUES ( 'Singer Name:', 'Shinned O''Connor' )

    works right.

  2. How to copy data from one table to another identical table?:

    Details


    INSERT INTO <destinationtable> SELECT * FROM <sourcetable>

© (c) 2001, Stanislav Malevanny