How to copy database stucture online

Hi!

I have to add a new functionnality in our Web application but i have no idea how to do it. What i have to do is to allow user to create a copy of the BD currently use and to save it on a new name. What i need is only the structure not the data. I need to copy all table, view, function and stored proc. I have no idea where to start. I found on this forum post where it says to detach then copy and the attach the BD but i can't do to this because i don't want other users on our web application to lost the connection with the DB.

So was is the best way to do this ?

Thanks !!

[609 byte] By [Sianspheric] at [2007-12-22]
# 1
You can easily do that by using SMO. Loop through the objects you want to duplicate and create a script for them. Afterwards apply the script to the new database or server.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

JensSuessmeyer at 2007-8-30 > top of Msdn Tech,SQL Server,SQL Server Database Engine...
# 2
right click the database then all task then click generate scripts
joeydj at 2007-8-30 > top of Msdn Tech,SQL Server,SQL Server Database Engine...

SQL Server

Site Classified