Use of some functions in sqlserver (05:
I. Time functions:
DateAdd ([year, Quarter, month, day], number, date)
Function Description: used for addition or subtraction within a specific time range
Parameter description: [year, Quarter, month, and day]
How to use convert:
Format:
CONVERT (Data_type,expression[,style])
Description
This style is generally in the type of time (datetime,smalldatetime) and String type (Nchar,nvarchar,char,varchar)
When they are converted to each other.
Example:
SELECT
-- Nested table and variable length array example:
Create
Type animal_ty
As
Object (Breed
Varchar2
(
25
),Names
Varchar2
(
25
),Birthdate date );
/**/
/*Create or replace type mytabletype as table of varchar2 (30 );*/
CONVERTUsage://////////////////////////////////////// //////////////////////////////////////// ////////Format:CONVERT (data_type, expression [, style])Note:This style is generally in the time type (datetime, smalldatetime) and string type (nchar,
CONVERT (Data_type,expression[,style])CONVERT (varchar (10), field name, conversion format)DescriptionThis style is typically in the time type (Datetime,smalldatetime) and the string type (Nchar,nvarchar,char,varchar)It is only used when converting
CONVERT (Data_type,expression[,style])CONVERT (varchar (10), field name, conversion format)
DescriptionThis style is generally in the type of time (datetime,smalldatetime) and String type (Nchar,nvarchar,char,varchar)When they are converted to each
Phenomenon:
Yes, a company system that adds a new feature that allows users to select his prefer time format when a page is generated, with the following four time formats to choose from:
Default OPTION:YYYY-MM-DD
Descriptive (1-jan-07)
Short
This article analyzes and summarizes some common usage analysis of the convert () function during date operations.
This article analyzes and summarizes some common usage analysis of the convert () function during date operations.
CONVERTUsage:
///
It mainly describes the actual operation process of SQLServer to use convert to obtain datetime date data. In actual operation, converdatabase uses convert to obtain datetime date data. The following examples include conversions of various date
CONVERT function format in SQL:CONVERT (data_type, expression [, style])Parameter description:ExpressionIs any valid Microsoft® SQL Server™ expression ..Data_typeThe data types provided by the target system, including bigint and SQL _variant.
ConvertExplicitly converts a data type expression to another data type. Because some requirements often use different date formats, You Can format the date in SQL Server.
SQL Server supports the use of KuwaitAlgorithmData format in the Arabic
Convert function [data type conversion]
--------------------------------------------------------------------------------
FunctionReturns the expression converted to the provided data type.
SyntaxConvert (data type, expression [, format-style])
Today, I encountered the problem of converting the date field. After the problem was solved with the help of SQL king, I found the relevant materials on the Internet to learn!SqlDataSource1.SelectCommand = "SELECT ***** '+ RIGHT (XkzSqs. QYMC, LEN
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
Explicitly converts a data type expression to another data type. CAST and CONVERT provide similar functions.Syntax
Use CAST:
CAST (expression AS data_type)
Use CONVERT:
CONVERT (data_type [(length)], expression [, style])Parameters
Expression
Is any
Cast and convert
Explicitly converts a data type expression to another data type. Cast and convert provide similar functions.Syntax
Use cast:
CAST ( expression AS data_type )
Use convert:
CONVERT (data_type[(length)], expression [,
There are multiple methods to compare strings with C #, such:
1. string. Compare (x, y );2. string. Equals (x, y );
If it is case-insensitive, the result is:String. Compare (x, y );String. Equals (x, y );
Note: The meaning of the comparison result
1.
In oracle in English, the default date format is 'dd-MON-YY ',
For example, '01-Jan-98'
In the Chinese version of the Chinese version, the default Oracle date format is 'day-month-Year', for example, '21-January-2003-'or '21-January-03'
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.