title: Whats the best to run sql scripts stored in a text column?
body: <p>I've got the task to automate the database modification scripts in our simulation server.</p>
  
  <p>Each simulation generates a few databases, all based from an common base DB, which is empty. </p>
  
  <p>But now is needed to do the same to get the data from last year's simulation database.</p>
  
  <p>I devised to create an clone of that DB based on a backup from the moment we need. And apply all database changes from the moment the DB was created till now.</p>
  
  <p>So the mechanism I imagine is something that can run an script (like the ones generated either by ER/Studio or SSMS) stored in a version table - which will be called from a SQL Agent job step.</p>
  
  <p>EDIT:
  What is the simplest way to do that - running an script stored in a table from an SQL Agent job step? </p>
  
  <p>P.S.: if the solution can avoid xp_cmdShell or sql_cmd or even preprocessing the script either in Delphi or in a SQLCLR function, it's better - but if's the only way I can cope with that.</p>