DoCmd.TransferSQLDatabase method (Access)
Transfers the entire specified Microsoft SQL Server database to another SQL Server database.
Syntax
expression.TransferSQLDatabase (Server, Database, UseTrustedConnection, Login, Password, TransferCopyData)
expression A variable that represents a DoCmd object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Server | Required | Variant | The name of the SQL Server to which the database will be transferred. |
Database | Required | Variant | The name of the new database on the specified server. |
UseTrustedConnection | Optional | Variant | True if the current connection is using a login with system administrator privileges. If this argument is not True, you must specify a login and password in the Login and Password arguments. |
Login | Optional | Variant | The name of a login on the destination server with system administrator privileges. If UseTrustedConnection is True, this argument is ignored. |
Password | Optional | Variant | The password for the login specified in Login. If UseTrustedConnection is True, this argument is ignored. |
TransferCopyData | Optional | Variant | True if all data in the database is transferred to the destination database. If this argument is not True, only the database schema will be transferred. |
Remarks
The following conditions must be met or else an error occurs:
The current and destination servers are SQL Server version 7.0 or later.
The user has system administrator login rights on the destination server.
The destination database doesn't already exist on the destination server.
Example
This example transfers the current SQL Server database to a new SQL Server database called Inventory on the server MainOffice. (It's assumed that the user has system administrator privileges on MainOffice.) The data is copied along with the database schema.
DoCmd.TransferCompleteSQLDatabase _
Server:="MainOffice", _
Database:="Inventory", _
UseTrustedConnection:=True, _
TransferCopyData:=False
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기