<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Visual C# Developers</title><subtitle type="html" /><id>http://msbdusers.net/blogs/rh_vcsdev/atom.aspx</id><link rel="alternate" type="text/html" href="http://msbdusers.net/blogs/rh_vcsdev/default.aspx" /><link rel="self" type="application/atom+xml" href="http://msbdusers.net/blogs/rh_vcsdev/atom.aspx" /><generator uri="http://communityserver.org" version="2.0.60217.2664">Community Server</generator><updated>2008-04-10T04:11:00Z</updated><entry><title>Generate insert statements for a table</title><link rel="alternate" type="text/html" href="http://msbdusers.net/blogs/rh_vcsdev/archive/2008/04/10/661.aspx" /><id>http://msbdusers.net/blogs/rh_vcsdev/archive/2008/04/10/661.aspx</id><published>2008-04-10T11:11:00Z</published><updated>2008-04-10T11:11:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;As professional software developers, we often face a situation where a desparate need of the SQL statement "&lt;STRONG&gt;insert into TableA values&lt;/STRONG&gt;..." arises&amp;nbsp;for tests &amp;amp; reviews&amp;nbsp;and due to time constraint, it seems pretty difficult to migrate data from SQL Express to SQL 2000, etc. using a sql script.&lt;BR&gt;&lt;BR&gt;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.&lt;BR&gt;&lt;BR&gt;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:&lt;BR&gt;&lt;BR&gt;&lt;B&gt;&lt;U&gt;SQL&lt;/U&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;FONT face=Verdana size=1&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=1&gt; &lt;FONT color=#ff0000&gt;'insert into TABLENAME values ('&lt;/FONT&gt; &lt;FONT color=#808080&gt;+&lt;/FONT&gt; &lt;FONT color=#ff00ff&gt;cast&lt;/FONT&gt;&lt;FONT color=#808080&gt;(&lt;/FONT&gt;ID &lt;FONT color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;varchar&lt;/FONT&gt;&lt;FONT color=#808080&gt;)&lt;/FONT&gt; &lt;FONT color=#808080&gt;+&lt;/FONT&gt; &lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=1&gt;&lt;FONT color=#ff0000&gt;','&lt;/FONT&gt; &lt;FONT color=#808080&gt;+&lt;/FONT&gt; &lt;FONT color=#ff00ff&gt;cast&lt;/FONT&gt;&lt;FONT color=#808080&gt;(&lt;/FONT&gt;VERSEID &lt;FONT color=#0000ff&gt;as&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;varchar&lt;/FONT&gt;&lt;FONT color=#808080&gt;)&lt;/FONT&gt; &lt;FONT color=#808080&gt;+&lt;/FONT&gt; &lt;FONT color=#ff0000&gt;','''&lt;/FONT&gt; &lt;FONT color=#808080&gt;+&lt;/FONT&gt; POEM &lt;FONT color=#808080&gt;+&lt;/FONT&gt; &lt;FONT color=#ff0000&gt;''');'&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face=Verdana&gt;&lt;FONT size=1&gt;&lt;FONT color=#0000ff&gt;AS&lt;/FONT&gt; INSERT_STAEMENTS&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;FONT color=#0000ff&gt;&lt;PRE&gt;&lt;FONT face=Verdana size=1&gt;FROM&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=1&gt; SOMETABLE;&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;img src="http://msbdusers.net/aggbug.aspx?PostID=661" width="1" height="1"&gt;</content><author><name>hamid</name><uri>http://msbdusers.net/members/hamid.aspx</uri></author></entry></feed>