> For the complete documentation index, see [llms.txt](https://learnsql.gitbook.io/lernmysql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learnsql.gitbook.io/lernmysql/full-text-search/huong-dan-chuyen-doi-du-lieu-tu-sql-sang-mysql-bang-cong-cu-workbench-ok.md).

# Hướng dẫn chuyển đổi dữ liệu từ sql sang mysql bằng công cụ workbench  (ok)

https\://docs.microsoft.com/en-us/sql/t-sql/statements/create-database-transact-sql?view=sql-server-2017

{% file src="/files/-M04xYhbOGa3f8Afg3O9" %}
Bản gốc
{% endfile %}

H. Attaching a full-text catalog that has been moved The following example attaches the full-text catalog AdvWksFtCat along with the AdventureWorks2012 data and log files. In this example, the full-text catalog is moved from its default location to a new location c:\myFTCatalogs. The data and log files remain in their default locations.

H. Đính kèm một danh mục toàn văn đã được di chuyển Ví dụ sau đây đính kèm danh mục toàn văn AdvWksFtCat cùng với các tệp nhật ký và dữ liệu AdventureWorks2012. Trong ví dụ này, danh mục toàn văn được chuyển từ vị trí mặc định sang vị trí mới c:  myFTCatalogs. Các tệp dữ liệu và nhật ký vẫn ở vị trí mặc định của chúng.

```
USE master;
GO
--Detach the AdventureWorks2012 database
sp_detach_db AdventureWorks2012;
GO
-- Physically move the full text catalog to the new location.
--Attach the AdventureWorks2012 database and specify the new location of the full-text catalog.
CREATE DATABASE AdventureWorks2012 ON
    (FILENAME = 'c:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Data\AdventureWorks2012_data.mdf'),
    (FILENAME = 'c:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Data\AdventureWorks2012_log.ldf'),
    (FILENAME = 'c:\myFTCatalogs\AdvWksFtCat')
FOR ATTACH;
GO
```

#### I. Creating a database that specifies a row filegroup and two FILESTREAM filegroups <a href="#i-creating-a-database-that-specifies-a-row-filegroup-and-two-filestream-filegroups" id="i-creating-a-database-that-specifies-a-row-filegroup-and-two-filestream-filegroups"></a>

The following example creates the `FileStreamDB` database. The database is created with one row filegroup and two FILESTREAM filegroups. Each filegroup contains one file:

I. Tạo cơ sở dữ liệu chỉ định một nhóm fileg hàng và hai filegRE FILESTREAM Ví dụ sau đây tạo cơ sở dữ liệu FileStreamDB. Cơ sở dữ liệu được tạo với một nhóm filegroup và hai filegRE FILESTREAM. Mỗi filegroup chứa một tệp:

* `ileStreamDB_data` contains row data. It contains one file, `FileStreamDB_data.mdf` with the default path.
* `FileStreamPhotos` contains FILESTREAM data. It contains two FILESTREAM data containers, `FSPhotos`, located at `C:\MyFSfolder\Photos` and `FSPhotos2`, located at `D:\MyFSfolder\Photos`. It is marked as the default FILESTREAM filegroup.
* `FileStreamResumes` contains FILESTREAM data. It contains one FILESTREAM data container, `FSResumes`, located at `C:\MyFSfolder\Resumes`.

```
USE master;
GO
-- Get the SQL Server data path.
DECLARE @data_path nvarchar(256);
SET @data_path = (SELECT SUBSTRING(physical_name, 1, CHARINDEX(N'master.mdf', LOWER(physical_name)) - 1)
      FROM master.sys.master_files
      WHERE database_id = 1 AND file_id = 1);

 -- Execute the CREATE DATABASE statement.
EXECUTE ('CREATE DATABASE FileStreamDB
ON PRIMARY
    (
    NAME = FileStreamDB_data
    ,FILENAME = ''' + @data_path + 'FileStreamDB_data.mdf''
    ,SIZE = 10MB
    ,MAXSIZE = 50MB
    ,FILEGROWTH = 15%
    ),
FILEGROUP FileStreamPhotos CONTAINS FILESTREAM DEFAULT
    (
    NAME = FSPhotos
    ,FILENAME = ''C:\MyFSfolder\Photos''
-- SIZE and FILEGROWTH should not be specified here.
-- If they are specified an error will be raised.
, MAXSIZE = 5000 MB
    ),
    (
      NAME = FSPhotos2
      , FILENAME = ''D:\MyFSfolder\Photos''
      , MAXSIZE = 10000 MB
     ),
FILEGROUP FileStreamResumes CONTAINS FILESTREAM
    (
    NAME = FileStreamResumes
    ,FILENAME = ''C:\MyFSfolder\Resumes''
    )
LOG ON
    (
    NAME = FileStream_log
    ,FILENAME = ''' + @data_path + 'FileStreamDB_log.ldf''
    ,SIZE = 5MB
    ,MAXSIZE = 25MB
    ,FILEGROWTH = 5MB
    )'
);
GO
```
