Skip to main content
Inspiring
September 30, 2008
Question

Create script of SQL 05 DB

  • September 30, 2008
  • 4 replies
  • 742 views
Do you know how to generate a script that will get all the FK,PK,indexes,views,contsraints of a SQL 05 DB?


I am using Rapid SQL...
Any solution....Thank you.
This topic has been closed for replies.

4 replies

emmim44Author
Inspiring
October 1, 2008
I used SQL Management studio it does create script but since the presedence of tables are important.. the created script throws lots of error...There are lots of circular constraints on tables...
emmim44Author
Inspiring
September 30, 2008
get creation scripts is needed...
Inspiring
September 30, 2008
To get the definition for views (functions, and stored procedures) you can query sys.sql_modules.

USE AdventureWorks

SELECT definition
FROM sys.sql_modules
WHERE OBJECT_NAME(object_id) = 'vEmployee'


If you have access to Microsoft SQL Server Management Studio you can use it to generate scripts.

http://msdn.microsoft.com/en-us/library/ms178078(SQL.90).aspx
Inspiring
September 30, 2008
Take a look at the sys.objects and sys.indexes views
http://msdn.microsoft.com/en-us/library/ms189783(SQL.90).aspx
Inspiring
September 30, 2008
emmim44,

Are you trying to get creation scripts for these objects or just check for existence in the database?
Inspiring
September 30, 2008
google "ms sql 2005 system tables"