title: Database copy doesn't copy views, stored procedures,
body: <p>I need to copy a database in SQL Server 2008 via script. I found this solution:</p>
  
  <pre><code>BACKUP DATABASE Database1 TO DISK='C:\temp\Database1.bak';
  
  RESTORE DATABASE Database2 FROM DISK='C:\temp\Database1.bak'
  WITH MOVE 'Database1' TO 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\Database2.mdf',
  MOVE 'Database1_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\Database2_log.ldf';
  </code></pre>
  
  <p>This works fine, I get all my tables with all the data, but it doesn't copy my views, stored procedures, functions, security (users, ...).</p>
  
  <p>When I do a restore in the GUI of the management studio (all tasks - restore database) all these objects will be restored. Am I missing some parameters?</p>