Often in a number of BBS above see someone asked access to convert to MS SQL What to pay attention to, or write stored procedures, now little brother to write some attention or common syntax for everyone to refer to (part of the common function of ASP)
-------------------
Access:now ()
MS Sql:getdate ()
-------------------
Access:mid
MS sql:substring (expression, start, length)
expression-the target to search, but cannot use aggregate functions
Start-the starting position of the specified string
length-Specifies the length of the string to get
-------------------
Asp:instr
MS Sql:charindex (expression1, expression2)
The position of the parameter is exactly the opposite of the ASP's InStr
-------------------
Asp:dim
MS Sql:declare @variable DataType
For example: Declare @VarName VarChar (50) declares variable @varname as VarChar type with a length of 50
-------------------
Assign value:
Declare @VarName VarChar (10)
Set @VarName = ' This is Content '
-------------------
Data type conversion functions, such as CSTR,CLNG of ASP
MS sql:cast (expression as DataType)
Expression as target object
DataType is the type of data to convert to
Example:
Declare @VarName VarChar (20)--Declare a @VarName variable to be of type VarChar, length 20
Set @VarName = ' 2 '--Assign value to @VarName
CAST (@VarName as int)--Convert to int type data
-------------------
string concatenation symbol: +
-------------------
Cycle:
While Boolean_expression
Begin
--the statement to execute
End
Boolean_expression is a Boolean expression that loops through the statement as long as the specified condition is true
-------------------
Usage of IF
if (boolean_expression)
Begin
--Perform a True branch ....
End
If....else ..... Use of
if (boolean_expression)
Begin
--Perform a True branch ....
End
Else
Begin
--Perform False branch
End
-------------------
Let's write so much later and update the dots.
These are commonly used, but sometimes it is difficult to find out, so write it
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.