How to script indexes, keys, foreign keys in SQL Server

Posted by dontomaso on Stack Overflow See other posts from Stack Overflow or by dontomaso
Published on 2010-12-28T08:35:20Z Indexed on 2010/12/28 11:54 UTC
Read the original article Hit count: 342

Filed under:
|
|
|

Hi,

I would like to get the details of all indexes, keys, and foreign keys from a database in SQL Server (2008). How do I do this?

I plan to use this to synchronize those properties across a couple of somewhat similar databases.

I can use SQL Server Management Studio, but I cannot do a full backup of a database because of restrictions set by the web hoster.

--

Secondary question that you do not need to answer:

Why can't there be something similar to the database schema in Mysql that simply lists all of the database structure in text SQL script format?

Thanks,

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about foreign-keys