text and image functions 1. Find a specific string patindexSyntax is the same as String patindex. 2. Get text pointer textptrWhen SQL Server stores text types (ntext, text), and image data types (images), the default is stored separately from data such as a common base data type (such as char, int, and so on), that is, if a field in a table has a base type and
text and image functions 1. Find a specific string patindexSyntax is the same as String patindex. 2. Get text pointer textptrWhen SQL Server stores text types (ntext, text), and image data types (images), the default is stored separately from data such as a common base data type (such as char, int, and so on), that is, if a field in a table has a base type and
Question 1:
A company printed a batch of rechargeable cards and the card password was randomly generated. Now this problem occurs:The "O and 0" (OH and 0) "I and 1" (AH and 1) in the card. The user reports cannot be clearly understood, and the company decides, change all "oh" in the password stored in the database to "zero", and change all "I" to "1 ";
Write SQL statements to meet the preceding requirements;Database Table Name: card; password field na
@resultENDGO--TestSELECTDbo. BIGINTTO36HEXSTR ( *)Execute the above test SQL, return 0xZ, test success;Four, Additional InformationIn fact, it is not necessary to write BINARY2HEXSTR functions because SQL Server provides system functions that support conversion master.dbo.f
I. Time Functions
When using stored procedures and SQL functions, you may encounter time processing. For example, get and add or subtract time. The built-in Time Functions of SQL are used here. I will list these functions
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 datab
Sort out common functions of mysql and SQL Server for emergency purposes
I haven't used database functions for a long time. I have used them today. By the way, I have sorted out the previous ones. I personally think it is almost the same. I only have three databases: mysql, sqlserver, and oracle. since oracle is too me
Datalength (RTrim (' abc '))Returns a string after truncating all trailing spaces.where DATALENGTH () returns the number of bytes used to represent any expression.Select substring (' Abcdeft ', 3,2)Returns a character expression, binary expression, text expression, or part of an image expression.System functionsSelect Specialofferid,minqty,maxqty,isnull (maxqty,9999) as MaxQty2From AdventureWorks.Sales.SpecialOfferReplaces NULL with the specified replacement value.SELECT @ @rowcount, Rowcount_b
One, Custom function:
1. Can return the table variable2. There are a lot of restrictions, includingCannot use output parameters;Cannot use temporary tables;The operation inside the function cannot affect the external environment;The result set cannot be returned through a select;Cannot update,delete, database table;3. Must return a scalar value or a table variableCustom functions are generally used in a high degree of reusability, simple function, co
to hex 5;
Hexadecimal is inverted for the remainder, which is 5ce9, so decimal 23785 = hexadecimal 0x5ce9Third, decimal conversion to 36 binaryThe conversion from decimal to 36 can be supported by the above example modification:650) this.width=650; "src=" Http://common.cnblogs.com/images/copycode.gif "alt=" Copy Code "style=" Border:none RGB ( 221,221,221); Background-color:rgb (255,255,255); "/>--decimal conversion to hexadecimal createfunctionbigintto36hexstr (@value bigint) Returnsvarch
In SQL Server 2012, several conversion functions have been added to support forced conversions of data types.Since the main use of SQL Server 2008R2, the company's projects to improve development efficiency, many table columns are varchar type, but also store numbers.When th
set into n groups according to the specified quantity, and give each group a group number, grouped in a very easy way, the total number of records of the result set divided by N, if the number of M, the first M group will add a record, therefore, not all groups have the same number of records. However, a multi-record group has only one record.Select Top *,ntile (2) over (partition by ProductID The above SQL statements are debugged under
Label:Original address: http://blog.csdn.net/xyzqiang/article/details/6577831 Add and subtract functions for SQL Server Date: DATEDIFF DATEADDDATEDIFF: Returns the number of date boundaries and time boundaries across two specified dates, syntax: DATEDIFF (datepart, StartDate, enddate) minus EndDate with StartDateNote: datepart specifies which part of the date sho
Working with dates in PHP is inconvenient, such as finding a month between two dates? What should we do?
File name: date.inc.php3
Before using these two functions, convert the date or datetime to the timestamp type.
Such as:
$today =mktime (0,0,0,date ("M"), Date ("D"), Date ("Y"));
/**** simulation of DATEADD functions in SQL
Simulate two SQL server functions: dateadd () and datediff (). read the two functions that simulate SQL Server: dateadd (), datediff (),? Php // File name: date. inc. php3 // before using these two
Label:Original: SQL Server function Full solution System information includes the currently used database name, hostname, system error message, and user name, among other things. Use the system functions in SQL Server to obtain this information when needed. The function and
Tags: Comm style back nbsp where rollup for logs effectsFirst, the window function over the role of two: 1, sort order by,row_number, flip page 2, zoned area partition by, combined with aggregation function for a part of the data to summarize SQL Server statements that turn pages: Select from Select as from as where t.num>6 and t.num Second, view: used to store a SELECT statement. is not a container for
Label: functions commonly used to intercept strings in SQL Server:1. Left(character_expression, integer_expression) function Description: Left('Source String','to intercept the leftmost number of characters') returns the specified number of characters from the left of the stringSelect Left('sql_server_2008',4 ); Return Result: Sql_2. Right(character_expression,
:
DECLARE @error_mes varchar (+)
Set @error_mes =' Here is a description of the error thrown by user%s '
RAISERROR (@error_mes, 16,1,1)
Because 1 is not a string, you need to use%i or%d if you want to replace it with an integer. All correspondence relate to the following:1,%d or%i represents a signed integer2,%u represents an unsigned integer3,%o represents an unsigned octal number4,%s represents a String5,%x or%x represents an unsigned hexadecimal number V. [WITH option
Tags: expr eal Pat name recording function Demo expression codeDuring the use of SQL Server, several functions (stored procedures) that are useful, but less common (or less detailed) are found:Isnumeric,isdate,patindex,newid,collate,sp_executesql,checksumWrite it down for future enquiries. Dare not to enjoy alone, with the king of the total. Useful and look, usel
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.