As professional software developers, we often face a situation where a desparate need of the SQL statement "insert into TableA values..." arises for tests & reviews and due to time constraint, it seems pretty difficult to migrate data from SQL Express to SQL 2000, etc. using a sql script.
Today I was doing a search on the web on a different keyword and accidentally got hold of a SQL statement showing how to generate insert statements for a table in your database. My bitter experience with migrating data from one version to another sparked back with the same feeling of bitterness. So, without any delay, I fired up my SQL Management Studio and copy/pasted the sql statement and hit execute button.
No! It's not working!! Incorrect syntax error!!! Embarrased and keeping the idea of just found statement, I developed my own in no time. Here it is for you to share with:
SQL
SELECT 'insert into TABLENAME values (' + cast(ID as varchar) +
',' + cast(VERSEID as varchar) + ',''' + POEM + ''');'
AS INSERT_STAEMENTS
FROM
SOMETABLE;