I. Basics1. Description: create a databaseCreate database database-name2. Description: Delete a database.Drop database dbname3. Description: back up SQL server--- Create a device for the backup dataUSE masterEXEC sp_addumpdevice 'disk', 'testback', '
Data operations between different server databases
--Create a linked server
exec sp_addlinkedserver ' itsv ', ', ' SQLOLEDB ', ' Remote server name or IP address '
exec sp_addlinkedsrvlogin ' itsv ', ' false ', NULL, ' username ', ' password '
--
Backup restore: A server as the primary server, the client update is updated on a server, B server is secondary server, b timing and a consistent, the result of B a copy/backup, but there is a difference in time. Implementation method: a scheduled
Data Development-Classic
1. Sort by last name stroke:
Select * from TableName Order by CustomerName Collate chinese_prc_stroke_ci_as//from less to more
2. Database encryption:
Select Encrypt (' original password ') Select
https://bbs.csdn.net/topics/230059074Https://www.cnblogs.com/vinsonLu/p/4456027.htmlData operations between different server databasesThe library name of the database is the Dvnewsprovider=sqloledb database is connected by SQL--Create a linked
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
/* 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 '--
Tag: style ar color using SP for data on logaccessing remote databases with SQL statements1, to establish a linked server:--Delete linked serverif exists (SELECT * from Master.dbo.sysservers where isremote=0 and Srvname= ' ITSV ')exec sp_dropserver '
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
Lele.xu-sql Server cross-Library queryWay One: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.fieldMode
SQL Server statement Operations--1, getting the table's primary key fieldSelect name from syscolumns where id=object_id (' table name ') and colid= (select top 1 colid from Sysindexkeys where id=object_id (' table Name '))Select A.column_name From
1. enable ad hoc distributed queries
Enable the ad hoc distributed queries service before using OpenRowSet/OpenDataSource. Because this service is insecure, sqlserver is disabled by default.
How to enable ad hoc distributed queries
SQL Server
Version 1 -- 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
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 encrypt ('original password ')Select pwdencrypt ('original password ')Select
You often need to modify the data in the database through the stored procedure. You need to configure distributed transactions on the source and target database servers. The configuration process is cumbersome, distributed transactions are caused by
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.