SQL SERVER – 2008 – 2008 R2 – Create Script to Copy Database Schema and All The Objects – Data, Schema, Stored Procedure, Functions, Triggers, Tables, Views, Constraints and All Other Database Objects
Trình bày lại:
- Trần Hán Huy – tranhanhuy.wordpress.com
Phần mềm:
- Sql server 2008
- Sql server 2008 R2
Nội dung:
- Hướng dẫn xuất script database gồm : data, trigger, function ….
Hướng dẫn:
Quite often I get the request regarding how to copy all the objects – including schema and data from any database and re-create it on another instance.
SQL Server 2008 and SQL Server 2008 R2 has script generator wizard which does it for us. I ask you to pay special attention to image #5.
After the script is generated, the next challenge often users face is how to execute this large script as SQL Server Management Studio does not open the file. One can use SQLCMD for the same. See that in the last image of this post.
Pay attention to the option Types of data to script – select option ‘Schema and data’
As the file with data will be very large, use SQLCMD to execute the large script which will create database with schema & data.
Sql 2008 Management Tools: Không thể lưu lại khi có sự thay đổi ở database
Tác giả:
- Trần Hán Huy – tranhanhuy.wordpress.com
Phần mềm:
- SQL Server 2008
Nội dung:
- Sql 2008 Management Tools: Không thể lưu lại khi có sự thay đổi ở database
Hướng dẫn:
- Khi có sử thay đổi bất kì ở table / row … khi đã được lưu lại trước đó và lần thay đổi này không thể lưu lại, hiện 1 hộp thoại thông báo như sau:
- Để khắc phục sự cố này: Bạn hãy vào
- Tools | Options | Designers | Tables and Designers and bỏ check Prevent Saving Changes that require table re-creation
Hướng dẫn export Script SQL trong MySQL Workbench
Tác giả:
- Trần Hán Huy – tranhanhuy.wordpress.com
Phần mềm:
- MySQL Workbench 5.2 CE
Nội dung:
- Hướng dẫn export Script SQL trong MySQL Workbench
Hướng dẫn:
Thực hiện các bước sau (xuất ra script sql bao gồm cả stored procedure)
- Đây là màn hình tab SQL Editor. Bạn menu Database / Reverse Engineer… (Ctrl + R)
- Sau đó hiện một hộp thoại Reverse Engineer Database. Sau đó chọn Stored Connection của bạn để kết nối. và thực hiện các thao tác theo hướng dẫn của chương trình (next , next, chọn database mình cần export, next, Execute, next, finish)
- Sau đó qua tab MySQL Model, chọn database mà mình cần xuất, sau đó vào File / Export / Forward Engineer SQL CREATE Script (Ctrl + shift + G)
- Sau đó hiện một hộp thoại Forward Engineer SQL Script. Thực hiện các thao tác còn lại do chương trình yêu cầu. tập tin Script nằm ở chỗ mà lúc đầu out put do bạn định