Discover sql server synchronize tables between databases, include the articles, news, trends, analysis and practical advice about sql server synchronize tables between databases on alibabacloud.com
name and password can be ignored.
RDA. internetlogin = "";
RDA. internetpassword = "";
RDA. interneturl = "http: //" + remoteip + "/sqltms/ sqlcesa30.dll ";
RDA. localconnectionstring = localconnectstring;
// Execute synchronization and synchronize SQL Server to sqlce
// The rdatrackoption. trackingon parameter indicates that
1. Create a publishing and distribution server
[Welcome to the configuration release and distribution wizard]-> [select a distribution server]
-> [Make "@ servername" its own distribution server, and SQL server will create distribution
Lx_data1:Use Lx_data1goinsert into t_student values (1, ' Sylvester Stallone ', 22, ' New York Elementary ', ' one shift ', ' ') insert into t_student values (2, ' Schwarzenegger ', 23, ' Washington Elementary ' , ' One shift ', 90)We then looked at the results of two databases:Use Lx_data1goselect * from T_studentuse lx_data2goselect * from T_studentAs a result we will find that the data is synchronized, such as:Five, matters needing attention1, whether it is publishing replication or subscrip
are recorded in a data table,When the Merge Agent runs, it collects GUIDs in the data tables that indicate which rows were modified at the publisher and at the Subscriber. For data that is modified only at the publisher or at the Subscriber, the corresponding actions are made directly, such asInsert,update,delete, if both parties have a GUID, the conflict is resolved in a user-specified manner, and the default publisher
type of publication. The default type of "Snapshot publication" is selected here. Several types of publishing differ, and SQL Server gives instructions below. Such as: 4. Select the class capacity to be published. Such as: The right side of the filter is the filtered SQL statement. 5. Set up the Snapshot Agent. Such as: Change the sync frequency as follows:
You can access SQL Server through ado, and execute corresponding SQL statements to create databases and tables. The following are definitions in SQL Server books online.
Table creat
Procedure
UID
Smallint
The schema ID of the object owner.For databases upgraded from the old version of SQL Server, the schema ID is equal to the owner's user ID.Important:If you use any of the following SQL Server DDL statements, you must use the SYS.
', ' 95 ', ' running ') 7. Query average score?Select AVG (score) as average scoreFrom Student-18. Query the surname Zhang?SELECT * FROM Student-1Where name like ' Zhang% '9. Use truncate to delete all dataTRUNCATE TABLE Student-1 Write so many examples just hope that everyone ingenious, this case is a student score table to do the demonstration, in exchange for other tables, the syntax is the same, this article is just a basic T-
1. System Table sysobjects
Each object (such as constraints, default values, logs, rules, and stored procedures) created in the database corresponds to a row.
Column name
Data Type
Description
Name
Sysname
Object Name
Id
Int
Object ID number
Xtype
Char (2)
Object type. It can be one of the following object types:AF = aggregate function (CLR)C = CHECK ConstraintsD = DEFAULT value or DEFAULT ConstraintF = foreign key constraintL = LogFN
(1) system table: stores all SQL system information. The metadata stored in the database service is called metadata (for example, the user databases on the data server, the login accounts on the database server, and
(1) system table: stores all SQL system information. The me
user account (or the corresponding ID of the account ). When other users log on to the system, the system first queries from this temporary table to check whether the same user records exist. If yes, the user will be rejected and the user will be warned that the same user has logged on. When the user exits the system normally or ends the current session due to other reasons, the database system will clear the contents of this table. In this way, you can log on to the system even if you log on t
-- Delete Table----------------------------------------------------------------------------------To add a constraint:ALTER TABLE Table name ADD CONSTRAINT constraint name constraint type specific constraint description1. The naming rules for constraint names are recommended in the form of constraint type _ constraint name.----------------------------------------------------------------------------------To delete a constraint:There are two ways to add a constraint to a specified tabl
Two tables linked to different libraries in the same server
This approach is limited to databases on the same server.I. Establishment of two databases, library a (table a) and Library B (table B).Second, to two libraries to assign the same account permissions.Use the following statement when querying:
The
A Left JOINIntfsimsnew. SYSOBJECTS B onA.name = B.nameWHEREISNULL (B.name,"') ="' andA.xtype =' U 'ORDER by 1,2--Compare the differences of each table field in two databasesSELECTTable name A = Case whenISNULL (A.tablename,"') "' ThenA.tablenameELSEB.tablenameEND, field name A = a.fieldname, field name B = b.fieldname, order = a.fieldsno, Description = Case whenA.fieldtype Then ' type: '+ A.fieldtype +' --'+ B.fieldtype whenA.fieldsno Then ' Order: '+ STR (A.FIELDSNO) +' --'+ STR (B.FIE
server| Create | stored Procedure | dynamic | data | database
The following are ways to create databases, tables, stored procedures, views, indexes, rules, modify tables, view data, and so on, using SQL statements. The controls you want to add are as follows:
Imports System.
I. Querying the database (Sys.databases--select *from sys.databases where name= ' Select *fromwhere name='MyDatabase'Second, query table (sysobjects--select *from sysobjects where id=object_id (' Select *fromwhere id=object_id ('studentsinfo')Third, query column (Syscolumns--select COUNT (*) from syscolumns where name= ' Select from where name='sname' and id=object_id ('studentsinfo ')Iv. querying a stored procedure or view (SELECT * from sysobjects where name= '
The database->ssmstest-> table there, you will find the three tables that have just been created.(Select Database->ssmstest-> table->dbo.student Right-click to select the design to see the details of the table you just created.) ) 3.2 Creating tables with SQL statements 3.2.1 Select Database->sqltest, and then select New Query. Notice the box in the upper left c
@ whereand parameter can narrow the output range according to the filter.
You can also add an order by statement. In the following example, the number of rows in each data table in the AdventureWorks database is returned and sorted by data indication:
exec sp_MSForEachTable@command1 = "Print '?'", @command2 = "select count(*) from ?", @whereand = "ORDER BY 1"
The following are some output results:
[HumanResources].[Department]-----------16[HumanResources].[Employee]--
In special cases, the sysaltfiles primary database contains the rows corresponding to the files in the database. The table is stored in the master database.Each character set in the syscharsets primary database occupies one row in the table. The table also contains the definition for Microsoft? SQL Server? The sort order used. One of the sorting orders is marked as the default sorting order in sysconfigures
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.