Sunday, March 25, 2012

exporting db structure

Hi,

is there a way of exporting a database structure and not the data in it?

Thanks.

Can you explain what you mean by "database structure"? If you mean the list of tables, stored procs, views, functions etc then sure you can. Just query the sysobjects table.|||

thanks for the reply. That's what I meant; I want to "copy" the database and move it to another server but I do not need all the data in it; just the tables, functions, stored procedures, ...

|||Have the profiler running, and right click on DB -> All Tasks -> Generate scripts. See what procs get called. You can do the same from your app and generate the schema structure. If its a once in a while thing, you can do it yourself manually as I mentioned above rather than writing a tool for it.|||Thanks Dinakar. This is something I will be doing often so I do need to write a tool for this. I haven't done this before, so if you could point me in the right direction on how to write such a script, I'd appreciate it.|||

Hi,

As Dinakar mentioned, the script can be get with a SQL Profiler trace. Just start the trace and generate schema scripts.

sql

No comments:

Post a Comment