1. view the database version
Select @ version
2. view the operating system parameters of the machine where the database is locatedExec master .. xp_msver
3. view database startup parametersSp_configure
4. view the database startup timeSelect convert (varchar (30), login_time, 120) from Master .. sysprocesses where spid = 1
View database server name and Instance namePrint 'server name ...... + convert (varc
query is invalid and an error is generated:Copy codeThe Code is as follows:Select *From (select orderid, customerid from orders order by orderid)As dThe following view also produces errors.Copy codeThe Code is as follows:Create view my_viewAsSelect *From ordersOrder by orderidError message:Msg 1033, Level 15, State 1, Procedure my_viewasselect, Line 2The order by clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or for xml is also
; text and ntext are suitable for text data files.
Note: during import, all rows meeting the conditions will be overwritten.During export, all rows that meet the conditions will also be exported to the specified file.
This stored procedure is only implemented using BCP--2003.08 -----------------*/
/* -- Call example-- Data exportExec p_binaryio 'zj', '','', 'Acc _ demo data .. tb', 'img ', 'c:/zj1.dat'
-- D
Basic SQL Server statements (1): Basic SQL Server statements
1. Insert a row of data:Insert into Table Name (column name) VALUES (corresponding value );2. Insert multiple data records at a timeCreate a table first:Insert into new table name (list) SELECT original table column name FROM original table;Create a table dur
fixed and variable columns in a table exceeds the limit of 8k, SQL Server dynamically moves one or more variable-length columns to the page in the Row_overflow_data allocation unit, starting from the largest column. (Readme: Move a column in a table to a different page). This will be done whenever the insert or update operation increases the total size of the row to a limit of 8,060 bytes. When you move a
Tags: style http os io file data ar Line0. IntroductionSQL Server Supply number Daquan SQL stalking and things told to oversee the database engine in the Seizure keyword mining tool.By documenting what you specify, SQL stalking can help you deal with functional questions, review database activity, collect sample data for test environments, debug Transact-
SQL Server gets the first record in each group
In daily life, we often need to record some operations, similar to the operation of the log, the last record is valid data, and maybe they belong to different aspects, functions below, from the terminology of the database, is to find a piece of data in each group. Here's what we're going to do is implement the first piece of data from each group in
granularity of the lock requires fewer locks, it will improve the performance. A small-granularity lock reduces blocking because it locks fewer resources and improves concurrency. However, a large number of locks may also cause performance degradation. Therefore, the lock granularity shows the relationship between performance and concurrency.
Figure 8. Impact of lock Granularity on performance and concurrency
SQL
SQL Server SQL statement Import and ExportOverview: SQL statements of the Microsoft SQL Server database are imported and exported, including data imported and exported with other databases and files.
/*** Export to excelExec mas
Database practical SQL statement -- view the foreign key constraint of a specified table select * fromsysobjectswhereparent_objin (selectidfromsyso
SQL Server database practical SQL statement -- view the foreign key constraints of a specified table select * from sysobjects where parent_obj in (select id from syso
Mysql SQL SERVER mode introduction, mysqlsql Server Mode
Mysql SQL Server Mode
The MySQL server can operate in different SQL modes, and can apply different modes to different clients. I
Original address: http://www.cnblogs.com/lyhabc/p/3367274.htmlBefore reading this article, you can read the following article firstSQL Server's unique task scheduling algorithm "Sqlos"Task Scheduler for SQL Server Sqlos [go]Translated from:http://rusanu.com/2013/08/01/understanding-how-sql-server-executes-a-query/Http:
In today's article, I want to talk about the very controversial and complex topic of SQL Server: The ambiguity of the ORDER by clause.View and Order byLet's start with a very simple SELECT statement.1 -- A very simple SELECT statement 2 SELECT * from Person.person 3 ORDER by LastName 4 GO from the code just listed you can see that we only want to return records from the Person.person table sorted by Last
reference value, it is also worthwhile.Back to top SQL Server Join modeIn SQL Server, each join command runs in three more specific ways when it executes internally:1. "Nested Loops join", if one join input is small and the other join is large and the index has been created on its join column, then the index Nested Lo
Join modeIn SQL Server, each join command runs in three more specific ways when it executes internally:1. "Nested Loops join", if one join input is small and the other join is large and the index has been created on its join column, then the index Nested Loops connection is the fastest join operation because they require minimal I/O and comparison.Nested loops joins are also known as nested iterations, whi
index (primary key creates a clustered index by default), and the number 7 is about 2, and less than 10, does SQL Server move the data ROWID = 10 down when the insert operation is performed? Obviously SQL Server is not so stupid, but only append ROWID = 7 data data to ROWID = 10 after the row of data, and then modify
procedure:EXEC Custorderdetail ' 2 'withRESULTsets( varchar(), varchar (+), varchar (+), varchar (+), varchar (+)) ;The exec parameter with Results set can redefine the returned column name or type based on the actual return result of the stored procedure. Refer to the following SQL statement:CREATE PROCEDUREDenali_withresultset asBEGIN SELECT1 as No, ' Tsql ' Type, ' Withresultset ' asFeatureUNION All SELECT2 as No
limit of 8,060 bytes, SQL Server dynamically moves one or more variable-length columns to the page in the Row_overflow_data allocation unit, starting at the maximum length of the column. This will be done whenever the insert or update operation increases the total size of the row to a limit of 8,060 bytes. When you move a column to a page in a Row_overflow_data allocation unit, a 24-byte pointer is maintai
procedure that is exported to a database by using bcp:
Import export of/*--bcp-binary files
Support for import/export of Image,text,ntext fields
Image is suitable for binary files; text,ntext for text data files
Note: When importing, all rows that meet the criteria are overwritten
When exporting, all rows that meet the criteria are also shown in the specified file
This stored procedure is implemented
, @ Tempname Nvarchar ( 25 ) Set @ Tempid = 100 Select @ Tempid = Personid, @ Tempname = Persionname From Persion Select @ Tempid , @ Tempname
If the SELECT statement does not return any rows, it will not change the value of the variable.
1.3 conditional select
Because select statements can contain where clauses, you can use the following syntax to assign values to variables:
Select @ Variable =ExpressionWhereBoolean
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.