The new date and time types in SQL Server 2008 are datetime2 and datetimeoffset.
Datetime2 data type, It is similar to the datetime type, but its precision is relatively high. It can be precise to the last 7 digits (100ns) after the decimal point. Its syntax is datetime2 (n ). Example:
Declare
@ Dt
As
Datetime2 (
5
)
Set
@ Dt
=
Getdate
()
Select
@ Dt
The http://msdn.microsoft.com/zh-cn/library/system.datetimeoffset.ticks (VS.95). aspx
Gets the number of time cycles, which indicates the date and time of the Current DateTimeOffset object in the clock time.
TicksThe property is not affected by the Offset property value.
TicksThe value of the attribute indicates the number of intervals (MinValue value) between January 1, 0001 nanoseconds that have elapsed since midnight, January 1, 100 .). One nanos
Date-time functions 1. Get the current date getdateThe GETDATE () function returns the date and time of the computer on which the current SQL Server servers are located, in the format of the datetime data type. Its syntax format is GETDATE (). The return value is rounded to the nearest fractional fraction of the second, with a precision of. 333 seconds the database 17 offset is not included.Example:Select GETDATE ()--Output 2013-03-09 15:16:00.5702.
After years of controversy, Microsoft finally cut the date-time data type, adding 4 new date-time data types in one breath in the new version of SQL Server 2008, including:
Date: A pure date data type.
Time: A pure temporal data type.
DateTime2: A new datetime type that mentions precision to 100 nanoseconds.
DateTimeOffset: The new datetime type, which adds the time zone section based o
Label:Date-time functions 1. Get the current date getdate The GETDATE () function returns the date and time of the computer on which the current SQL Server servers are located, in the format of the datetime data type. Its syntax format is GETDATE (). The return value is rounded to the nearest fractional fraction of the second, with a precision of. 333 seconds the database 17 offset is not included. Example: Select GETDATE ()--Output 2013-03-09 15:16:
To create a database:1 CREATE DATABASETest--The name of the database to be created2 on PRIMARY3 (4 --specific description of the database file5NAME='Test_data',--logical name of the master data file6FILENAME='E:\project\Test_data.mdf',--physical name of the master data file7SIZE=5MB,--Initial size of master data file8MAXSIZE=100MB,--maximum growth of the master data file9FileGrowth= the% --growth rate of master data filesTen ) One LOG on A ( - --the specific
Inter-function 1. Get the current date getdateThe GETDATE () function returns the date and time of the computer on which the current SQL Server servers are located, in the format of the datetime data type. Its syntax format is GETDATE (). The return value is rounded to the nearest fractional fraction of the second, with a precision of. 333 seconds the database 17 offset is not included.Example:-- output 2013-03-09 15:16:00.5702. getUTCDate get UTC ti
Tags: http using ar strong for data SP art onAfter years of controversy, Microsoft finally cut the date-time data type, adding 4 new date-time data types in one breath in the new version of SQL Server 2008, including:
Date: A pure date data type.
Time: A pure temporal data type.
DateTime2: A new datetime type that mentions precision to 100 nanoseconds.
DateTimeOffset: The new datetime t
Tags: ide font arch ACE float table name Process class styleIn the development process often need to write the corresponding entity class according to the data table, the following is the use of SQL statements to quickly convert the data table to the corresponding entity class code, use only the first line of ' TableName ' quotation marks inside the letter to the specific table name on the line: Declare @TableNamesysname= 'TableName'
Declare @Result v
Java. util. Date and Java. SQL. Date, java. SQL. Time, java. SQL. Timestamp interchange, java. SQL. timestamp
1. SQL time type to util time type
Principle: java. SQL. date, java. SQL. t
The following table lists the. NET Framework type, dbtype, sqldbtype enumeration, and sqldatareader accessors.
SQL Server database engine type
. NET Framework type
Sqldbtype Enumeration
Sqldatareader sqltypes type accesser
Dbtype Enumeration
Sqldatareader dbtype type accessors
Bigint
Int64
Bigint
Getsqlint64
Int64
Getint64
Binary
Byte []
Varbinary
Getsqlbinary
Binary
Getbytes
Tags: implementation mechanism originally page organizes tables based on free article content index ClustFollowing the book on SQL tuning (SQL tuning or SQL optimization) in the essentials of high-performance SQL tuning and case resolution, we talk today about one of the most important core mechanisms of
? What quarter does this date belong to in the year 2016? What day of the quarter does this date belong to? Does this date belong to the first half or the second half of 2016 years? The day of the year 2016? ...... Some companies have their own company special financial processing cycle time period, such as: 4 months, 4 months, 3 months for different time periods of the financial processing cycle.time granularity provided by SQL ServerLet's take a l
When you create a table, you must assign a data type to each column in the table. This section describes some of the most common data types in SQL Server. Even if you create a custom data type, it must be based on a standard SQL Server data type. For example, you can use the following syntax to create a custom data type (Address), but be aware that it is based on the SQ
35. use SQL query analyzer and SQL profilerUse SQL query AnalyzerUse SQL profilerOptimize T-SQL statementSummaryIn this chapter, we will continue with the description of the pre-stored procedures in Chapter 21st. This chapter describes how to use
13. T-SQL and SQL query AnalyzerWhat is SQL?What is T-SQL?Introduce new features of T-SQLHow to Use T-SQLSummaryIn this chapter, we will introduce some basic concepts about the Structured Query Language What is SQL? SQL is a datab
Sqlserver Management
Common field types: Bit (optional values: 0, 1), datetime, Int, varchar, and nvarchar (may contain nvarchar for Chinese)
Differences between varchar, nvarchar, and char (N): Fill in spaces for less than N parts of char (n. VaR: Variable, variable.
SQL statements
Use strings in SQL statementsSingle quotes.
SQL
---- Set a non-primary key to clustered index [Step 4] to: http://king123654789.iteye.com/blog/1169191
1. View All indexes. Clustered indexes are created on the primary key by default.Sp_helpindex person
2. -- delete the primary key constraint and remove the index constraint on the primary key queried in [1], for example, PK _ person _ 117F9D94. Remove the primary key constraint from the primary key field. This field is not the primary key.Alter table person drop constraint PK _ person _ 117F9
Artificial Intelligence automatic SQL optimization tools-SQLTuning for SQL Server, SQL-sqltuning
In response to this situation, the artificial intelligence automatic SQL optimization tool came into being. Now I will introduce this tool: SQLTuning for SQL Server.
1.
Recently, I encountered a problem: Solving the Problem of displaying the time of American and Chinese companies. The current database records the United States time and displays the China time zone on the Chinese webpage. And consider the issue of timeout.
The SQL Server 2005 data time format does not support international time zones.
The time format of SQL Server 2008 solves the time zone problem. Provid
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.