bitsCN.com
SQL SERVER 2000用sql语句如何获得当前系统时间
就是用GETDATE();
Sql中的getDate()2008年01月08日 星期二 14:59
Sql Server 中一个非常强大的日期格式化函数
Select CONVERT(varchar(100), GETDATE(), 0);-- 05 16 2008 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1);-- 05/16/08
Select CONVERT(varchar(100), GETDATE(), 2);-- 08.05.16
Select CONVERT(varchar(100), GETDATE(), 3);-- 16/05/08
Select CONVERT(varchar(100), GETDATE(), 4);-- 16.05.08
Select CONVERT(varchar(100), GETDATE(), 5);-- 16-05-08
Select CONVERT(varchar(100), GETDATE(), 6);-- 16 05 08
Select CONVERT(varchar(100), GETDATE(), 7);-- 05 16, 08
Select CONVERT(varchar(100), GETDATE(), 8);-- 10:57:46
Select CONVERT(varchar(100), GETDATE(), 9);-- 05 16 2008 10:57:46:827AM
Select CONVERT(varchar(100), GETDATE(), 10);-- 05-16-08
Select CONVERT(varchar(100), GETDATE(), 11);-- 08/05/16
Select CONVERT(varchar(100), GETDATE(), 12);-- 080516
Select CONVERT(varchar(100), GETDATE(), 13);-- 16 05 2008 10:57:46:937
Select CONVERT(varchar(100), GETDATE(), 14);-- 10:57:46:967
Select CONVERT(varchar(100), GETDATE(), 20);-- 2008-05-16 10:57:47
Select CONVERT(varchar(100), GETDATE(), 21);-- 2008-05-16 10:57:47.157
Select CONVERT(varchar(100), GETDATE(), 22);-- 05/16/08 10:57:47 AM
Select CONVERT(varchar(100), GETDATE(), 23);-- 2008-05-16
Select CONVERT(varchar(100), GETDATE(), 24);-- 10:57:47
Select CONVERT(varchar(100), GETDATE(), 25);-- 2008-05-16 10:57:47.250
Select CONVERT(varchar(100), GETDATE(), 100);-- 05 16 2008 10:57AM
Select CONVERT(varchar(100), GETDATE(), 101);-- 05/16/2008
Select CONVERT(varchar(100), GETDATE(), 102);-- 2008.05.16
Select CONVERT(varchar(100), GETDATE(), 103);-- 16/05/2008
Select CONVERT(varchar(100), GETDATE(), 104);-- 16.05.2008
Select CONVERT(varchar(100), GETDATE(), 105);-- 16-05-2008
Select CONVERT(varchar(100), GETDATE(), 106);-- 16 05 2008
Select CONVERT(varchar(100), GETDATE(), 107);-- 05 16, 2008
Select CONVERT(varchar(100), GETDATE(), 108);-- 10:57:49
Select CONVERT(varchar(100), GETDATE(), 109);-- 05 16 2008 10:57:49:437AM
Select CONVERT(varchar(100), GETDATE(), 110);-- 05-16-2008
Select CONVERT(varchar(100), GETDATE(), 111);-- 2008/05/16
Select CONVERT(varchar(100), GETDATE(), 112);-- 20080516
Select CONVERT(varchar(100), GETDATE(), 113);-- 16 05 2008 10:57:49:513
Select CONVERT(varchar(100), GETDATE(), 114);-- 10:57:49:547
Select CONVERT(varchar(100), GETDATE(), 120);-- 2008-05-16 10:57:49
Select CONVERT(varchar(100), GETDATE(), 121);-- 2008-05-16 10:57:49.700
Select CONVERT(varchar(100), GETDATE(), 126);-- 2008-05-16T10:57:49.827
Select CONVERT(varchar(100), GETDATE(), 130);-- 18 ???? ?????? 1427 10:57:49:907AM
说明:
使用 CONVERT:
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )
参数
expression
是任何有效的 Microsoft® SQL Server™ 表达式。。
data_type
目标系统所提供的数据类型,包括 bigint 和 sql_variant。不能使用用户定义的数据类型。
length
nchar、nvarchar、char、varchar、binary 或 varbinary 数据类型的可选参数。
style
日期格式样式,借以将 datetime 或 smalldatetime 数据转换为字符数据(nchar、nvarchar、char、varchar、nchar 或 nvarchar 数据类型);或者字符串格式样式,借以将 float、real、money 或 smallmoney 数据转换为字符数据(nchar、nvarchar、char、varchar、nchar 或 nvarchar 数据类型)。
SQL Server 支持使用科威特算法的阿拉伯样式中的数据格式。
在表中,左侧的两列表示将 datetime 或 smalldatetime 转换为字符数据的 style 值。给 style 值加 100,可获得包括世纪数位的四位年份 (yyyy)。
不带世纪数位 (yy) 带世纪数位 (yyyy)
标准
输入/输出**
- 0 或 100 (*) 默认值 mon dd yyyy hh:miAM(或 PM)
1 101 美国 mm/dd/yyyy
2 102 ANSI yy.mm.dd
3 103 英国/法国 dd/mm/yy
4 104 德国 dd.mm.yy
5 105 意大利 dd-mm-yy
6 106 - dd mon yy
7 107 - mon dd, yy
8 108 - hh:mm:ss
- 9 或 109 (*) 默认值 + 毫秒 mon dd yyyy hh:mi:ss:mmmAM(或 PM)
10 110 美国 mm-dd-yy
11 111 日本 yy/mm/dd
12 112 ISO yymmdd
- 13 或 113 (*) 欧洲默认值 + 毫秒 dd mon yyyy hh:mm:ss:mmm(24h)
14 114 - hh:mi:ss:mmm(24h)
- 20 或 120 (*) ODBC 规范 yyyy-mm-dd hh:mm:ss[.fff]
- 21 或 121 (*) ODBC 规范(带毫秒) yyyy-mm-dd hh:mm:ss[.fff]
- 126(***) ISO8601 yyyy-mm-dd Thh:mm:ss.mmm(不含空格)
- 130* Hijri**** dd mon yyyy hh:mi:ss:mmmAM
- 131* Hijri**** dd/mm/yy hh:mi:ss:mmmAM
* 默认值(style 0 或 100、9 或 109、13 或 113、20 或 120、21 或 121)始终返回世纪数位 (yyyy)。
** 当转换为 datetime时输入;当转换为字符数据时输出。
*** 专门用于 XML。对于从 datetime或 smalldatetime 到 character 数据的转换,输出格式如表中所示。对于从 float、money 或 smallmoney 到 character 数据的转换,输出等同于 style 2。对于从 real 到 character 数据的转换,输出等同于 style 1。
****Hijri 是具有几种变化形式的日历系统,Microsoft® SQL Server™ 2000 使用其中的科威特算法。
重要 默认情况下,SQL Server 根据截止年份 2049 解释两位数字的年份。即,两位数字的年份 49 被解释为 2049,而两位数字的年份 50 被解释为 1950。许多客户端应用程序(例如那些基于 OLE 自动化对象的客户端应用程序)都使用 2030 作为截止年份。SQL Server 提供一个配置选项("两位数字的截止年份"),借以更改 SQL Server 所使用的截止年份并对日期进行一致性处理。然而最安全的办法是指定四位数字年份。
当从 smalldatetime 转换为字符数据时,包含秒或毫秒的样式将在这些位置上显示零。当从 datetime 或 smalldatetime 值进行转换时,可以通过使用适当的 char 或 varchar 数据类型长度来截断不需要的日期部分。
Select CONVERT(varchar(100), GETDATE(), 131): 18/04/1427 10:57:49:920AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Notepad++7.3.1
Easy-to-use and free code editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),