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
There is such a requirement that it creates an SQL Server query, including the cumulative value based on the event time. A typical example is a bank account, because every time you save and withdraw money at different times. For any account, you must calculate the sum of the loan (deposit) and loan (withdrawal) at a certain point in time. After each transaction,
Today, I encountered a strange problem in configuration: 192.168.x.x, the operating system win2008x64sp1, and the database sqlserver2008 phenomenon: SQL Server query, the local machine is normal, other machines in the same network segment, the query speed is very slow (login is fast, 250 records of small table
There is a requirement that it create a SQL Server query that includes cumulative values based on the event time. A typical example is a bank account, because you are saving and taking money at different times each time. For any account, at a point in time to calculate its borrowing (deposits) and credit (withdrawal) of the sum. After each transaction, you want t
Original: MS SQL Server with time records how to queryFor example, a table [a] has a save date containing the Time field [b], if the paragraph [b] as the query criteria to query data records. And we have to spend some time trying to find the records we want.Now we need to query
Tags: database from logical ASE file path font includes logic case SELECT db_name(database_id) as [Database Name],[Name] as [Logical Name],[Physical_name] as [Physical Name], ((Size* 8)/ 1024x768/1024x768) as [Size (GB)],[Differential_base_time] as [differential Base time]
fromSys.master_files 1 , query the remaining space for each disk partition:Exec master.dbo.xp_fixeddrives 2 , querying database data files and log files related information (in
Atitit.mysql the use of the Oracle with AS Mode temp table pattern CTE statement to reduce the structural MSSQL SQL for subqueries Server:1. With ... as (...) in the MySQL what should be said in 12. Sub-query and query nesting is mainly easy to improve readability, 23. the solution in MYSQL :: temp table. 24. Seo bla
The company database grows with time, the data is more and more, the query speed is also more and more slow. Into the database to see a bit, hundreds of thousands of of the data, the query is really time-consuming.To improve the query performance of SQL, we generally consider the index as the first consideration. In fa
SQL Server uses fuzzy query to process special characters.
Today, when I was dealing with SQL queries, I encountered the like Query problem, so I analyzed the problem.
Problem:
Select * from v_workflow_rt_task_circulate where Name like '% [admin] application for leave of
stored procedure.
In particular, do not use nested views. nested views increase the difficulty of searching for original data. Let's look at the nature of the View: it is stored on the server.
The optimized SQL query plan has been generated. When retrieving data from a single table, do not use a view pointing to multiple tables.
You can retrieve or read the view
Wbk_goods_info where cop_g_no= ' 00078027 'There are only 1 records in the Wbk_goods_info table that meet this condition, and the entire data table has 100,000 records, so the selectivity of this query is 1/100000, which represents very high selectivity, so it is efficient to find data by index. Conversely, or your statement is as follows:Select * from Wbk_goods_info with (index (IDX_COP_G_NO)) where cop_g_no> ' 00018000 'At this time the matching
XML query in SQL SERVER: FOR XML specifies AUTO
Preface
In SQL SERVER, you can specify RAW, AUTO, EXPLICIT, and PATH for XML queries. This article uses some examples to introduce the XML query of AUTO in
Tags: sql/**9. SQL Server method for querying database size **/--Headquarters request every one months, to obtain an ERP database growth size.-- Original Source: http://www.jb51.net/article/30993.htmselect db _name ( database_id as [Database name] [Name] as [ Logicalname] [physical_name] as [ Physical Name] size * 8) / 1024) [Size (MB)] [Differential_b
(ColumnProperty (A.id,a.name,' Scale'),0) asNumber of decimal digits, ( CaseWhen a.isnullable=1Then'√'Else "'end) allow null, IsNull (E.text,"') Default value, IsNull (G.[value],"'As field description from syscolumns a LEFT join systypes B on A.xtype=b.xusertype INNER join sysobjects D on a.id=d.id and D.xtype='U'and d.name'dtproperties'Left join syscomments e on A.cdefault=E.id left Join Sys.extended_properties G on a.id=g.major_id and A.colid =g.minor_id--whereD.nameinch(' Contact','Stockbmps
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'
@ Server machine name
@ Provider (U
SQL Server multi-Table query optimization solution highlights, sqlserver
The multi-Table query optimization solution of SQL Server is what we will introduce in this article. We provide the optimization solution and specific optimi
SQL Server database paging query has always been a short board of SQL Server, so I have nothing to worry about. I have come up with several methods, for example, table ARTICLE, field ID, YEAR... (others omitted). There are 53210 million pieces of data (the customer's actual
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
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.