is an integer value with a positive sign. 6, Datename () Datename (,) Returns the specified part of the date as a string in this section. specified by DatePart. 7, DATEPART () DATEPART (,) Returns the specified part of the date as an integer value. This section is specified by DatePart. DATEPART (dd, date) is equivalent to day (date) DATEPART (mm, date) equals month (date) DATEPART (yy, date) is equivalent
Label:Database Knowledge Points: First, the calculated field 1 NULL 's name into "anonymous"; Expression: Nullif (expression1, expression2)Meaning: If two expressions are not equivalent, NULLIF returns the value of the first expression1.If two expressions are equivalent, NULLIF returns a null value of the first expression1 type. 2, beween andcalculated fields such as: FsalarybetweenFage*1.5+ - andFage*1.8+ the
3, SQL syntax calculation, instead of t
A few questions about SQL (SQL advanced) and SQL advanced
When we get a question, we are not eager to answer the question. It will not be worth the candle, but to analyze the ideas, methods, and objectives, we also need to think about whether there are simple methods or general methods to achieve the same effect. In fact, this kind of inertial thinking was introd
like '% @ str %'Create an encrypted stored procedure or function WITH the with encryption parameter before theYou can use sp_decrypt to decrypt encrypted stored procedures and functions.10. View user and process information in the databaseSp_whoView information about active users and processes in the SQL Server databaseSp_who 'active'View the locks in the SQL Server databaseSp_lockProcess No. 1--50 is used
Often develop ASP but for the meticulous statement, the truth is not very clear, here a simple introduction.
Under normal circumstances
Read the data with Rs.Open sql,conn,1,1
Modifying data: Rs.Open sql,conn,1,3
Delete data: Directly to Conn.execute ("Delete * from new where id=1").
The Rs.Open syntax is as follows: Rs. Open Source,activeconnection,cursortype,locktype
Source is a
Tags: ash text results SQL tuning SRC completion need to end TunA few days ago, a user developed QQ to find me, as follows:The free Dolphin. 16:12:01The island owner, my SQL can not find the results, could you help me see?Orchid Island Main 16:12:10How long is the result?The Free Dolphin 16:12:17How long has not produced the result, has not seen the result.Orchid Island Main 16:12:26Oh, good.Orchid Island M
After a period of study, I have some knowledge about databases. databases are basically composed of tables, relationships, and operations.
After a period of study, I have some knowledge about databases. databases are basically composed of tables, relationships, and operations.
Figure 1 wins the 10 Statement: SQL Server database Summary
A rough summary
After a period of study, I also had some knowledge about databases.
Databases are basically compos
Many people do not know how SQL statements are executed in SQL Server, fearing that their written SQL statements will be misunderstood by SQL Server. Like what:
SELECT * FROM table1 where name= ' Zhangsan ' and TID > 10000
and implementation:
SELECT * FROM table1 where TID > 10000 and name= ' Zhangsan '
Some people
Looking for a ready-made function, I found that SQL Server users are lazy than me, and I don't even have this basic function! Good, because all I need is the serial number and it will be reset every month, and the maximum ordinal number will not exceed 0.1 million. So use Ribao: declare @ SNintdeclare @ SNLenintset @ SNLen5set @ SN1selectright (0
Looking for a ready-made function, I found that the SQL Serve
conversion style number provided by the SQL Server system when converting DATATIME and SMALLDATETIME to a string. Different style numbers have different output formats.VII. Date Functions1. day (date_expression)Returns the date value in date_expression.
2. month (date_expression)Returns the month value in date_expression.
3. year (date_expression)Returns the Year Value in date_expression.
4. DATEADD ()DATEADD (Returns the new date generated by the sp
Tags: system val SQL numeric GPO conversion nvarchar diff lisCONVERT (varchar (10), field name, conversion format)Convert is a date conversion function, which is typically used when the time type (Datetime,smalldatetime) and the string type (Nchar,nvarchar,char,varchar) are converted to each other. The 3 parameters of the function: The 1th argument is the converted large, the 2nd is the field or function of the converted date, and the 3rd is the conve
Tags: function name diff varchar randomly replace ABC Max Data add String functions
Name of function
Describe
Example
CHARINDEX
Finds the starting position of a specified string in another string
SELECT CHARINDEX (' Jbns ', ' My Jbns Course ', 1)Returns:4
Len
Returns the length of the string passed to it
SELECT LEN (' SQL Server course ')retu
Tags: Audit SQL ServerIntroductionAudit is a feature after SQL Server 2008 that tells you "who did what when?" Specifically, auditing an instance of the SQL Server database engine or a separate database involves tracking and documenting events that occur in the database engine. Its bottom-level is based on extended events (Extented event), so its performance and
in SQL Server by default, the start of each week starts from Sunday , if the default is Monday?Here are three ways to solve this problem:changing the new DimDate directly through SET datefirst VALUE, and then associating it with the Date Key each time you need to calculate Week number separately, but this requires constant JOIN DimDate, each record To get a LookUp againTwo:when you need to use the Week number in the stored procedure, set Datefirst fir
:00.000 Select DATEADD (qq,12, ' 1990-12-11 ') Back to 1993-12-11 00:00:00.000 Select DATEADD (hh,12, ' 1990-12-11 ') Back to 1990-12-11 12:00:00.000 Select DATEADD (yy,-12, ' 1990-12-11 ') Back to 1978-12-11 00:00:00.000 Returns a new date value that is added to the specified date after a time interval. Number: The value that is used to add to the specified date part. If a non-integer value is specified, The decimal portion of the value is discarded, and rounding is not followed when it is disc
A picture of "ten" words: SQL Server Database Summary
A rough summary.
After a period of study, also has some knowledge of the database.
The database is basically made up of tables, relationships, and operations; for beginners to learn first:
1. How the database stores the data
Tables, Constraints, triggers
2. How the database operates data
Insert,update,delete T-SQL function stored procedure triggers
3
Today, I would like to share with you the SQL statements, T-SQL usage and syntax, as well as some examples, the purpose is to help everyone to review the basic statements of T-SQL, so that the project can be used more quickly. Of course, it should be learned and summarized for new users.
Today, I would like to share with you the
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.