Http://www.pconline.com.cn/pcjob/other/data/mcdba/0409/456571.html
Often on some BBs saw someone asking access to convert to ms SQL what to pay attention to, or writing stored procedures, now, I want to write some notes or common syntaxes here for your reference (some are common ASP functions)
-------------------
Access: Now ()
Ms SQL: getdate ()
-------------------
Access: Mid
SQL MS: substring (expression, start, length)
Expression-target to be searched, but cannot use aggregate Functions
Start-specify the start position of the string
Length-specify the length of the obtained string
-------------------
ASP: instr
Ms SQL: charindex (expression1, expression2)
The parameter is in the opposite position as the ASP instr.
-------------------
ASP: dim
Ms SQL: declare @ variable datatype
For example, declare @ varname varchar (50) declares that the variable @ varname is of the varchar type and the length is 50.
-------------------
Assignment:
Declare @ varname varchar (10)
Set @ varname = 'this is content'
-------------------
Data type conversion functions, such as asp cstr and clng
Ms SQL: Cast (expression as datatype)
Expression is the target object.
Datatype is the data type to be converted
Example:
Declare @ varname varchar (20) -- declare a variable named @ varname in the varchar type with a length of 20
Set @ varname = '2' -- assign a value to @ varname
Cast (@ varname as INT) -- convert to int type data
-------------------
String Connection Symbol: +
-------------------
Loop:
While boolean_expression
Begin
-- Statement to be executed
End
Boolean_expression is a Boolean expression. If the specified condition is true, statements are executed cyclically.
-------------------
If usage
If (boolean_expression)
Begin
-- Execute true branch ....
End
Usage of IF... else...
If (boolean_expression)
Begin
-- Execute true branch ....
End
Else
Begin
-- Execute the false Branch
End