Alibabacloud.com offers a wide variety of articles about sql server common criteria compliance, easily find your sql server common criteria compliance information here online.
dateadd (DD, datediff (DD, 0, getdate (), 0)Go deep into datediff and dateadd function computeYou can understand that by using simple datediff and dateadd functions, you can find many different dates that may be meaningful.All the examples so far only calculate the number of time intervals between the current time and "", and then add it to the "" time interval to calculate the date. If you modify the number of time intervals, or use different time intervals to call the dateadd function, or sub
Sometimes, after importing local SQL Server data from a remote SQL Server, you can use the program to connect to the local database for debugging. The following errors may occur frequently, however, the remote and local connection to the remote database is good:Reference Error Type:Microsoft ole db Provider for
. The following query will also cause a full table scan:Select id from t where name like '% abc %'To improve efficiency, you can consider full-text search.
7. If a parameter is used in the where clause, a full table scan is performed. Because SQL parses local variables only at runtime, the optimizer cannot postpone the selection of the access plan to runtime; it must be selected at compilation. However, if an access plan is created during compilation,
all tables in the specified file group (in the current database)DBCC checkident checks the current ID value of the specified table. If necessary, it also corrects the id value of DBCC checktableChecks the integrity of the data, index, and text, ntext, and image pages of the specified table or index view.DBCC newalloc checks the distribution of data and index pages for each table in the extended structure of the database.
Other statementsDBCC dllname (free) detaches the specified dynamic link
Creating a WEB application, paging browsing is essential. This problem is a very common problem in database processing. The classic data paging method is: ADO Recordset Paging method, that is, the use of ADO's own paging function (using cursors) to achieve paging. However, this paging method only works with small amounts of data because the cursor itself has drawbacks: cursors are stored in memory and are memory-consuming. Once the cursor is establish
following query will also cause a full table scan:Select id from t where name like '% abc %'To improve efficiency, you can consider full-text search.7. If a parameter is used in the where clause, a full table scan is performed. Because SQL parses local variables only at runtime, the optimizer cannot postpone the selection of the access plan to runtime; it must be selected at compilation. However, if an access plan is created during compilation, the v
We often use a variety of date formats for some purpose. Of course, we can use string operations to construct various date formats, but why are there any ready-made functions? The default datetime format of the Chinese version of SQL Server is yyyy-mm-dd thh: mm: Ss. mmm example: Select getdate () 11:06:08. 177 sort out the date format conversion methods that may be frequently used in
We often use a variety of date formats for some purpose. Of course, we can use string operations to construct various date formats, but why are there any ready-made functions?
The default datetime format of the Chinese version of SQL Server is yyyy-mm-dd thh: mm: Ss. Mmm.
For example:
Select getdate ()
11:06:08. 177
I sorted out the date format conversion methods that may be frequently used in
The date and time data from January 1, January 1-20, 1900 to January 1, June 6 are accurate to minutes.String
Char
A fixed length of non-Unicode characters. The maximum length is 8,000 characters.
Varchar
Variable-length non-Unicode data, which can contain a maximum of 8,000 characters.
Text
Variable-length non-Unicode data. The maximum length is 2 ^ 31-1 (2,147,483,647) characters.Unicode string
Nchar
Unicode data of a fixed length. The maximum length is 4,000 characters.
Nvarchar
A variable-l
Such a problem is undoubtedly the first difficult problem for beginners like ours after getting started with SQL Server, "Real-time error '91 'object variable or with Block Variable not set" is exposed in the end? I still can't see anything until I write this blog post, but I know some of the reasons. Is there a problem with it, or is it difficult for me to understand the mystery?
But now I don't
The default datetime format for ms SQL Server Chinese edition is yyyy-mm-dd hh: mm: Ss. Mmm
Long/short Date Format
CopyCode The Code is as follows: -- short Date Format: yyyy-m-d
Select Replace (convert (varchar (10), getdate (), 120), N'-0 ','-')
-- Long Date Format: yyyy-mm-dd
Select stuff (convert (char (8), getdate (), 112), 5, 0, N 'Year'), 8, 0, N 'month') + N'
-- Short Date Format: yyyy-mm-dd
Select
logarithmS:select log (2.7182818284590451) value 1O:select ln (2.7182818284590451) value from dual; 1
8. Take 10 as the base logarithmS:select log10 (a) value 1O:select log (10,10) value from dual; 1
9. Take the SquareS:select SQUARE (4) value 16O:select Power (4,2) value from dual 16
10. Take the square rootS:select SQRT (4) Value 2O:select SQRT (4) value from dual 2
11. To find any number of the bottom of the powerS:select Power (3,4) value 81O:select Power (3,4) value from dual 81
12. T
=b.index_idanda.object_id=c.object_idanda.column_id=c.column_idAndb.name= ' Ix_test2 'ORDER by a.index_column_id[Email Protected]_field_names=left (@index_field_names, LEN (@index_field_names)-1)PRINT @index_field_names--check constraint, data source sys.objects.type= ' C 'Select*from SYS. Check_constraints WHERE object_id=?--Compatibility View sysconstraints--Data source Sys.objects.type=dSelect*from SYS. Default_constraints WHERE object_id=?--Compatibility View sysconstraints--PRIMARY KEY or U
--count the total number of StatesSELECT sum( Case when [Status] =-1 Then 1 ELSE 0 END) asQ1,sum( Case when [Status] =0 Then 1 ELSE 0 END) asQ2,sum( Case when [Status] =1 Then 1 ELSE 0 END) asQ3,sum( Case when [Status] =2 Then 1 ELSE 0 END) asQ4,sum( Case when [Status] =3 Then 1 ELSE 0 END) asQ5,sum( Case when [Status] =4 Then 1 ELSE 0 END) asQ6,sum( Case when [Status] =5 Then 1 ELSE 0 END) asQ7 fromOrderInfoCommon statistics usage for SQL
Create a databaseCREATE DATABASE database_nameExample: CREATE DATABASE TestExecute commands first when creating a tableUse testCreate a tableCREATE TABLE table name (column name 1 data type, column name 2 data type, ... )Example: Create table book (name char), writer varchar (20))You can set some fields to be self-increment when you create a table, but the field property must be of type intThe CREATE TABLE table name (column name int identity (A, b)) A represents the increment starting from a,In
Label:LEN (String) returns the length of the character in this string.ISNULL (Check,return) null value function. Checks if check is null and returns the value of return if null.DATEADD (unit,duration,date) returns this new datetime value by adding or subtracting a period of time from the specified date. Unit units (Year,day ...), duration--interval length (can be negative), date to be modified.SUBSTRING (str,index,length) intercepts the string method. STR: The string to be intercepted; index: fr
Original: SQL Server Tuning Series Basics (Summary of common operators)ObjectiveIn the previous article we looked at how to view the query plan, this article will introduce the analysis techniques in the query plan we looked at, as well as several of our commonly used operator optimization techniques, the same emphasis on the master of basic knowledge.In this art
Label:Original: SQL Server Tuning Series Basics (Summary of common operators)ObjectiveIn the previous article we looked at how to view the query plan, this article will introduce the analysis techniques in the query plan we looked at, as well as several of our commonly used operator optimization techniques, the same emphasis on the master of basic knowledge.In th
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.