How to import system tables, stored procs and views - database-schema

In VS 2010, when importing master db, all system tables, views and stored procedures cannot be imported into my project. There are no scripts under Tables, Views and StoredProcedure folders.
For custom db, the scripts can be generated properly.
How can I make the scripts for system object generate for me?

You will need to import master.dbschema as a reference into your project.
See the following http://msdn.microsoft.com/en-us/library/bb386242.aspx

Related

postgres exporting database file to preserve index

I have been using postgres to build a large database for my research, and I need to export the database to allow my users to use the database I have developped.
In the past I have been exporting database in .csv file and it was a stable choice, but my users have all sorts of problem when import the .csv file, and settting up the database, and create index.
I am wondering if I can help users to preserve all the necessary information like index and view, in my database export, so users can just import the file and no need to touch the database I prepared for them. I am wondering exporting sql dump will help me do that?

How to take backup of database objects (tables scripts, stored procedures and functions etc) in SQL Server using SQL scripts

I have a question about SQL Server: how to take script database objects automatically using T-SQL script and keep into specific foleder (e.g. c:\backup\)
Create monthly tables structure (create without data), views, procedures, functions and triggers backups with unique names and all are in one file and keep it into specific folder in SQL Server.
I have tried like below using ssms manually
right click on database
click Task -> Generate Scripts -> Choose Objects -> Select entire database
and all database objects (tables, view, function and triggers etc) ->
set scripting option choose the required directory name and save file
Please tell me how to achieve this task in SQL Server.

Data Import deletes any VIEWS that were previously created

I've created VIEWS in PostgreSQL recently. I run on a daily basis an import script that ingested the DB with new data by dropping all schemas and tables and then re-creating the schemas and importing the data.
Is there a way of keeping the created VIEWS in the DB?
I didn't realize that the VIEWS would be deleted as well. The reason why they are not recreated as the Schemas is that the script reads from a source DB while the VIEWS are created on the target.
Are there other ways of circumventing this? Or any workarounds for re-using VIEWS or similar in this methodology - of dropping the schemas every day.
Thanks

How to restore database schema using DDLgen utility

I am using the ddlgen tool to get DDLs or whole databases. Now I need to re-generate databases into another location (structure only).
Can anyone help me to re-create database schema in another location?
ddlgen creates sql scripts
To recreate your database structure, just run the scripts in the correct order against your new system.
isql -Uusername -Sservername -iDDLGenScript.sql
If you have multiple scripts, then this is the recommended order from the SAP ASE Documentation
Segment
Group
User
Rules
Defaults
UDDs
Encrypted Keys
User Tables
Proxy Tables
Triggers
Functions and Views
All functions without any dependency
All views without any dependency
All functions and all views with any dependency on any objects
Instead of trigger
Stored Procedures
Extended Stored Procedures
PRS
User Defined Web Services

How update database schema from EF5.0 model first changes?

I'm using VS2012 and EF 5.0 with a model first approach. I am wondering if there is any good way to generate incremental DDL to update model changes without dropping all the tables and losing the data I have in there already.
I like to use a SQL server data project within Visual Studio to keep my data in sync with the database - it's like a mini SQL server schema store.
Basically what we are doing here is updating the schema of the data project using the model's DDL script, then comparing and pushing those changes out to the database. Just be sure to generate your model's DDL script first.
Create a new SQL Server Database project
Right click data project and import your existing schema from the database server
Right click data project and import your generated DDL script from model first project.
Right click data project and do a schema compare of your project vs. your database server
Update database based on this schema compare (click update)
Every time you want to update your database just generate and import your models' sql script, compare, and update. It takes a couple steps but works perfectly.