1, temporary use method OpenRowsetA. Using OPENROWSET with SELECT with Microsoft OLE DB Provider for SQL ServerThe following example uses Microsoft OLE DB Provider for SQL Server to access the authors table of the pubs database on a remote data server named REMOTE1. Initializes the provider from DataSource, user_id, an
Tags: exec add update insert LED link server local DSR columnCreate a linked server exec sp_addlinkedserver ' itsv ', ' ', ' SQLOLEDB ', ' Remote server name or IP address 'exec sp_addlinkedsrvlogin ' itsv ', ' false ', NULL, ' username ', ' password ' --query ExampleSELECT * from ITSV. Database name. dbo. Table name --import ExampleSELECT * into table from ITSV.
I. BACKGROUND
When you build SQL Server replication, if the network environment is within the LAN, through the host name can be achieved, but if it is across the network segment, across the computer room to build replication when you need to pay attention to, because SQL Server replication does not support through IP
The two methods for cross-server SQL query are generally not available if the security settings are complete, but the internal network is still good.
The two methods for cross-server SQL query are generally not available if the s
Today encountered a need to modify the remote server data, how to directly modify, and collapse library, cross-Library simple, directly add the database name, remote words need to create a linked server, the following steps:--创建链接服务器execsp_addlinkedserver‘SDDJG ‘,‘‘,‘SQLOLEDB‘,‘远程服务器名或ip地址‘exec sp_addlinkedsrvlogin‘SDDJG ‘,‘false‘,null,‘用户名‘,‘密码‘--whether the tes
is:Summary: Equivalent to the Cartesian product, the left table and the right table combination.2. There is a WHERE clause, which is usually the data table that is the product of two table row numbers, and is then selected from the Where condition.[SQL]View PlainCopy
SELECT * from t_student s cross join T_class c where s.classid = C.classid
(Note: after
are as follows: Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center "> conditionalDescription: The unconditional results found above are filtered according to the conditions but here only can be used to indicate that you cannot use on the results are as follows: Summary The phrase is given to himself and to all the readers:In the future, understand a piece of things will be its ins and outs, and to summarize, so that the futu
How to interact with XML in SQL ServerXML can be said to be a flexible form of database performance. During database development
XML is required, especially for data exchange. In SQL Server
2005, XML has become a popular data type
Because of business splitting, the database is split into two roles:
Summary database (Master, head node database),
Child node Database (Compute node, compute child node database)
In this way, the design to the child node access to the head node database of a summary table, the records of such tables generally in a few, to hundreds of thousands of rows or so, currently suitable for cross-library queries.Cross-Library queries are curr
) ') LastName
From XMLT CROSS APPLY xcol.nodes ('/xmltables/xmltable ') as R (nref) where id=1
--Read all nodes Nowtime
SELECT nref.value (' @NowTime ', ' varchar (max) ') LastName
From XMLT CROSS APPLY xcol.nodes ('/xmltables/xmltable ') as R (nref) where id=1
SELECT xcol.query (' Data (/xmltables/xmltable[@Name =5]/@
One, copy the database one table to another database (same server) SELECT * into table 1 from table 2--Copy table 2 If you only copy the structure without copying the content or just a column, just add the Where condition. Example:(Copy the Syslog table from database aimmanagedb to database imcdb) Second, copy a table from one database to another (cross-server)
Two SQL cross-Server Query implementation methods:
Select * From OpenDataSource (
'Sqlodb ',
'Data source = remote IP address; user id = sa; Password = password'
). Database Name. DBO. Table Name
Insert local database name .. table name select * From OpenDataSource (
'Sqlodb ',
'Data source = remote IP address; user id = sa; Password = password'
). Database Name
the duplicate columns in the Join table are deleted .outer JOIN (outer join)The outer joins are divided into: Left join (left join) or off-the-outside connection (the ieft outer join), right-join, or right-side-joins, or full-connection (full-join) or all-out (fully outer join).1, left JOIN connectWhen we concatenate a multi-table query, all rows in the left table are returned, and if the rows in the left table have no matching rows in the right table, the columns in the right table in the resu
Label: --enable the operation of other servers in this server
execsp_configure'Show advanced Options',1
Reconfigure --Output Message
execsp_configure'Ad Hoc Distributed Queries',1
Reconfigure --Output Message
--Increase
INSERT into OPENROWSET('SQLOLEDB','JX3XXIEDNR3UCIDF';'SA';'Aa12345', Yyg.dbo.T_Tabel_a) ([Name])VALUES('Zhang Hui')
--Delete
DELETE OPENROWSET('SQLOLEDB','JX3XXIEDNR3UCIDF';'SA';'Aa12345', yyg.dbo.T_Tabel_a)WHERE [Name] = 'Zhang Hu
1. Using OpenDataSourceSelect top *from opendatasource (' SQLOLEDB ', ' Data source=ip address; User id= connection name; password= Connect user password '). Remote target database. dbo. Table name2. Using a junction server--Create Linkserverexec sp_addlinkedserver ' alias ', ' ', ' SQLOLEDB ', ' IP address '--Landing Linkserverexec sp_addlinkedsrvlogin ' Alias ', ' false ', NULL, ' Connect user name ', ' Connect user password '--QuerySELECT * from al
You often encounter situations where you need to insert bulk data into SQL Server and then further process the data in a stored procedure. The stored procedure does not have a parameter type such as an array or a list, and the XML type solves the problem properly.
However, SQL Server2005 support for standard
In the previous article, wherein and like implementation of SQL Server parameterized query describes several Implementation Solutions for SQL Server parametric query of wherein. xml and Table value parameters are omitted. Here is a supplement.
In the previous description of
name in the User Information table for CID 20 assigns him to the variable name declare @name varchar (10)-User name Select @name =username from userInfo where cid = 20 print ' cid 20 user name: ' + @name Recursive select variable: A recursive select variable refers to the use of a SELECT statement and a subquery to stitch together a variable with itself. The syntax form is as follows: Select @variable = @variable + table.column from table declare @
Basic ways to import/export Excel from SQL Server
/*=================== Import/Export Excel basic methods ===================*/
From the Excel file, import the data into the SQL database, very simply, using the following statement directly:
/*===================================================================*/
--If the table that accepts the data import alre
In the previous description of SQL Server parameterized query's where in and like implementation, we introduced several implementation schemes for SQL Server to use parameterized query where in, with XML and Table value parameters missing, here is a supplement
ArticleGuide
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.