Tags: englishromcopytimegroup by date settings mon language Tags: datepart function SQL used date month year grouping group by group 2013-12-26 15:31 20764 People read reviews (1) Favorite report Category: SQL Server (21) Copyright notice: This article for Bo Master original article, not allowed to reprint without Bo master. [
T-SQL time operations (dateadd, datediff, datepart, datename), datepartdatename
-- 1. current System Date and Time select getdate () -- 09:27:27. 277--2. the Time Operation dateadd returns the new datetime value dateadd (datepart, number, date) based on a period of time added to the specified date. Note: datepart: year
DATEADD (Ms,-3,dateadd (mm, DATEDIFF ()) + 1, 0))--. this week Monday select DATEADD (wk, DATEDIFF (Wk,0,getdate ()), 0)--. this week Sunday select DATEADD (Wk,datediff ( Wk,0,getdate ()), 6)--. the first day of the year select DATEADD (yy, DATEDIFF (Yy,0,getdate ()), 0)--. the last day of the year select DATEADD (ms,- 3,dateadd (yy, DATEDIFF (Yy,0,getdate ()) +1, 0))--. The first day of the quarter SELECT DATEADD (QQ, DATEDIFF (Qq,0,getdate ()), 0) --. Day of the Night SELECT DATEADD (
Label:Definition and usageThe DATEPART () function is used to return a separate part of a date/time, such as year, month, day, hour, minute, and so on.GrammarDATEPART (Datepart,date) The date parameter is a valid day expression. The datepart parameter can be the following value:
DatePart
Abbrevia
These functions in fact, many online data, but in order to facilitate their own memory, I still decided to write a bit, all say good memory than bad writing, so or write a bit more.The cast () function essentially converts one type to another, such as converting a string type to a time type: SELECT CAST (' 2011-10-2 ' as datetime), or convert the numeric type to a string type: SELECT CAST (1 as BIGINT) The CONVERT () function is mainly used to display date/time data in different formats: conve
The date and time functions in SQL Server are always problematic in this regard. So, I will summarize what I mainly useDatepart(Month, getdate (). This item can be set to day (now () in access. Unfortunately, the day () in SQL Server does not support parameters.Date and time functions in SQL Server
These scalar functions operate on the input values of date and ti
Label:DATEPARTReturns an integer representing the specified date portion of the specified date.GrammarDATEPART(datepart,date)ParametersDatePart is a parameter that specifies the date part that should be returned. The following table lists the date parts and abbreviations identified by Microsoft®sql Server™.
Date Part
Abbreviations
Year
YY, yyyy
Quarte
The number/frequency of SQL queries in ORACLE and the number of SQL queries in oracle
In ORACLE Database Application optimization, the execution Frequency/frequency of an SQL statement is also frequently concerned, because the exe
1. Character functions:
The characters in SQL Server are case-insensitive.However, the lower and upper functions are common in SQL Server, Oracle, and DB2. For example, select empno, ename, deptno from EMP where upper (ename) = upper ('bucket ');
Example of connection characters:• SQL SERVER: Select 'good '+ 'string'
Tags: style blog http io color OS SP for strongTo synchronize data from Oracle in real time to MS SQL Server, you need to read and write data directly to SQL Server in Oracle, and you can install the Oracle database for SQL Server
Tags: http io sp CTI on C SQL R BSWhere is the Oracle SQL Developer connection information saved?Oracle SQL Developer connection information is missing after switching the logged-on user. As long as the previous user information still exists, you can C:\Users\ the user name
Summary of index, foreign key, and field syntax maintenance for mysql, SQL Server, and oracle databases, and SQL Server oracle
Summary of index, foreign key, and field syntax maintenance for mysql, SQL Server, and oracle databases
It was freezing, and I stayed at home and read "Mastering Oracle SQL" 2nd. I found that Oracle is still very powerful, and there are two hundred optical functions. It is difficult to simulate the Object-Oriented Query languages, in particular, Windows functions for OLAP in sql2003.Fortunately, hibernate3.0 also supports SQL
Method 1:
As we all know, to connect to Oracle using PL/SQL, you need to install the Oracle client software. Have you ever wondered whether to directly connect to Oracle without installing the Oracle client?
In fact, I always wanted to do this, because this client is so
Oracle tablespace to view SQL usage, oracle tablespace SQL
In daily work, the most important thing for DBA is to check the usage of the tablespace to check whether the tablespace is full.
The procedure is as follows:
Step 1: Open PLSQL
Step 2: Create an SQL window
Step 3: E
"annual Salary"From EMP ORDER by 3 DESC;SELECT ename,job,sal from emp ORDER by Job,sal DESC;SELECT ename,job,sal from emp ORDER by Empno;Modify Default display widthSET line[size] {80|n}SET Line 100L display the SQL statement in the buffer you just enteredN Text modified section of error'/' (run) commandSAVEGET@ or Start command when the specified script file contents are loaded into the SQL buffer to runS
T-SQL is an enhanced SQL language provided by SQLServer based on the SQL language. The T-SQL provides all the features of ANSISQL and adds more features such as extended functions, system pre-storage, and program design structures. The following describes
3. the T-SQL of
Oracle tuning uses related SQL, oracle tuning related SQL
Select * from v $ session where username is not null;Select username, count (username) from v $ session where username is not null group by username;Select count (*) from v $ process;Select value from v $ parameter where name = 'processs ';Select count (*) from
Comparison of common functions for SQL Server to Oracle
1. Absolute ValueS: Select ABS (-1) ValueO: Select ABS (-1) value from dual
2. INTEGER (large)S: Select ceiling (-1.001) ValueO: Select Ceil (-1.001) value from dual
3. Round (small)S: Select floor (-1.001) ValueO: Select floor (-1.001) value from dual
4. Round (truncation)S: Select cast (-1.002 as INT) ValueO: Select trunc (-1.002) value from dual
5.
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.