title: In SQL Server, how do I generate a CREATE TABLE statement for a given table?
body: <p>I've spent a good amount of time coming up with solution to this problem, so in the spirit of <a href="https://stackoverflow.com/questions/21245/questions-vs-conveying-information">this post</a>, I'm posting it here, since I think it might be useful to others. </p>
  
  <p>If anyone has a better script, or anything to add, please post it.</p>
  
  <p>Edit: Yes guys, I know how to do it in Management Studio - but I needed to be able to do it from within another application.</p>