SQL code
Code highlighting produced by actipro codehighlighter (freeware) implements sp_add+server 'itsv', '', 'sqlodb', 'remote server name or IP address 'exec sp_add+srvlogin 'itsv', 'false ', null, 'username', 'Password' --
/* Data operations between different Server databases */-- Create a linked serverExec sp_addrole server 'itsv', '', 'sqloledb', 'remote server name or IP address'Exec sp_add1_srvlogin 'itsv', 'false', null, 'username', 'Password'-- Query
Data operations between databases */
-- Create a linked server
Exec sp_addrole server 'itsv', '', 'sqloledb', 'remote server name or IP address'
Exec sp_add1_srvlogin 'itsv', 'false', null, 'username', 'Password'
-- Query exampleSelect * From itsv.
Data operations between databases on different servers
-- Create a linked server
Exec sp_addrole server 'itsv', '', 'sqloledb', 'remote server name or IP address'
Exec sp_add1_srvlogin 'itsv', 'false', null, 'username', 'Password'
-- Query
/* Data operations between different Server databases */
-- Create a linked server
Exec sp_addrole server 'itsv', '', 'sqloledb', 'remote server name or IP address'
Exec sp_add1_srvlogin 'itsv', 'false', null, 'username', 'Password'
-- Query example
Create the linked server execsp_add1_serveritsv, SQLOLEDB, remote server name or IP address execsp_add1_srvloginitsv, false, null, user name, password -- Query example select * fromITSV. database Name. dbo. table name -- import example select * into
This article mainly describes the operation of accessing the remote database in the SQL Server database, including the activation of the ad HOC distributed queries service and an instance of accessing the remote database, which I hope can help
3. Develop applications
1. sort by strokes of the Last Name:
Select * From TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as // From less to more
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 28 29
Data operations between databases on different servers -- create a connection server execsp_add1_serveritsv, SQLOLEDB, remote server name or IP address execsp_add1_srvloginitsv, false, null, user name, password -- Query example select * fromITSV.
Data Development-classic and data development classicData Development-classic
1. sort by strokes of the Last Name:
Select * From TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as // From less to more
2. database encryption:
Select
Connect to the default instance of SQL server:
exec sp_addlinkedserver @ServerName, N'SQL Server'
Used to connect to a specified instance:
EXEC sp_addlinkedserver @server='SQL2005', @srvproduct='', @provider='SQLNCLI', @datasrc='DBhere'
@
1. Enable AD Hoc distributed Queries
To enable the ad Hoc distributed queries service before using Openrowset/opendatasource, because this service is not secure, SQL Server is turned off by default
Methods for enabling the ad Hoc distributed
1 , enable Ad Hoc Distributed QueriesBefore using Openrowset/opendatasource to enable the ad Hoc distributed queries service, because this service is not secure, SQL Server is turned off by defaultMethods for enabling AD HOC distributed queriesSQL
Data operations between different server databases--Create a linked serverexec sp_addlinkedserver ' itsv ', ' ', ' SQLOLEDB ', ' Remote server name or IP address 'exec sp_addlinkedsrvlogin ' itsv ', ' false ', NULL, ' username ', ' password '--query
//executing a remote database table querySelect * from OpenRowset('SQLOLEDB','192.168.5.547';'SA';'Password',[Database name].[dbo].[Table name])An exception occurred:News15281, Level16, State1, section 1 line SQL Server Blocked component ' ad
Enable AD Hoc distributed Queries: ' Show advanced Options ', 1
Reconfigure
' Ad Hoc distributed Queries ', 1
Reconfigure
When you are finished using, close ad Hoc distributed Queries:' Ad Hoc distributed Queries ', 0
Reconfigure
' Show
Data operations between different server databasesWays to replicate table data between different databases:When the table target table is present:INSERT INTO destination database: Table SELECT * FROM source database: TableWhen the target table does
In SQL Server database remote operations, first enable the Ad Hoc distributed Queries service before using Openrowset/opendatasource. Because this service is not secure, SQL Server is turned off by default.1. How to enable AD Hoc distributed
StatementSELECT * from database a.dbo. Table A, database b.dbo. Table b b WHERE A.field=b.field"DBO" can be omitted asSELECT * from Database A. Table A, database B.. Table b b WHERE A.field=b.fieldSQL Server database:--This is an IP or hostname that
Recently, a pdf.net user asked me how I could not access the Access database under a 64-bit system, and my first reaction was how did I not meet it? Today I see that my vs and office are all 32-bit versions, so debugging access in VS is no problem,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.