DB2 and SQLServer data transplantation

xiaoxiao2021-04-03  249

First, self-add sequence:

DB2:

Create Table TestTable

(

RecordIndex Integer Identity Generated As Always,

StringDatetime varchar (50),

TruedateTime Timestamp

);

SQLServer:

Create Table TestTable

(

RecordIndex Int Identity,

StringDatetime varchar (50),

TruedateTime DateTime

)

Second, record screening:

DB2:

Strtemp = "Select * from testtable fetch first 5 rows";

SQLServer:

Strtemp = "SELECT TOP 5 * from testtable";

Third, time function:

SQLServer:

STRTMPDB2 = "delete login log table where datediff (day, login time, getdate ())>" days;

DB2:

STRTMPDB2 = "DELETE Logue WHERE DATE - DATE - DATE ('" system.datetime.now.tostring () ")>" days;

SQLServer:

STRTMPDB2 = "AND CAST (Table. Accept date as datetime"> = '" Searchinfo.Begindate "' "

DB2:

STRTMPDB2 = "and Date" Date (Date ('" SearchInfo.begindate ") ";

SQLServer:

Strsql [lilosoft.cospace.util.dbtype.db2] = "Insert INTO document exchange sending table (document number, receiving unit, distribution time, transmission status) VALUES (@ strcode, @ strunit, getdate (), @ strmsg);

DB2:

Strsql [lilosoft.cospace.util.dbtype.db2] = "INSERT INTO document exchange sending table (document number, receiving unit, distribution time, transmission status) VALUES (@ strcode, @ Strunit, TimeStamp ('" system.datetime. Now.toString () "), @ strmsg);

Fourth, type check

SQLServer:

VARCHAR type and int type can be implicit conversion and connection calculation

DB2:

Implicit conversion and connection calculation cannot be performed between VARCHAR types and int types

Modify the role permission table role sequence field field type is Integer, the original type is VARCHAR

Modify the sequence field type field type field type field type field type INTEGER, the original type is VARCHAR

5, return to return

SQLServer:

"SELECT @@ Identity"

DB2:

"SELECT MAX" from Tablea "

Six, objects

SQLServer:

"SELECT * from dbo.tablea"

DB2:

"SELECT * from Tablea"

Seven, type check

SQLServer:

Bit type can be converted to BOOL by DOTNET default

DB2:

Smallint type cannot be converted to BOOL by default by DOTNET

Eight, standard support

SQLServer:

Delete Tablea WHERE A = a

DB2:

Delete from Tablea WHERE A = a

Nine, date format

The acceptance date field type in the table is VARCHAR (8), field values ​​such as: 20060113

SQLServer:

"And Cast" AS dateTime "> = '" strbegindate "" "

DB2:

And Date (Concat (Concat (Concat (Concat) Substr (handset table. Acceptance date, 7, 2)))) <= Date ('" strbegindate ") "

TRACKBACK: http://tb.blog.9cbs.net/trackback.aspx?postid=773290

转载请注明原文地址:https://www.9cbs.com/read-131677.html

New Post(0)