forked from mstgnz/sqlmapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlserver_map.go
More file actions
140 lines (136 loc) · 4.34 KB
/
sqlserver_map.go
File metadata and controls
140 lines (136 loc) · 4.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package sqlserver
// Data type conversion maps from SQL Server to other database types
var (
// SQLServerToMySQL Data type conversions from SQL Server to MySQL
SQLServerToMySQL = map[string]string{
"tinyint": "tinyint",
"smallint": "smallint",
"int": "int",
"bigint": "bigint",
"decimal": "decimal",
"numeric": "decimal",
"float": "double",
"real": "float",
"money": "decimal(19,4)",
"smallmoney": "decimal(10,4)",
"char": "char",
"varchar": "varchar",
"text": "text",
"nchar": "char",
"nvarchar": "varchar",
"ntext": "text",
"binary": "binary",
"varbinary": "varbinary",
"image": "longblob",
"datetime": "datetime",
"datetime2": "datetime",
"smalldatetime": "datetime",
"date": "date",
"time": "time",
"datetimeoffset": "datetime",
"timestamp": "binary(8)",
"bit": "boolean",
"uniqueidentifier": "char(36)",
"xml": "text",
"sql_variant": "text",
}
// SQLServerToPostgreSQL Data type conversions from SQL Server to PostgreSQL
SQLServerToPostgreSQL = map[string]string{
"tinyint": "smallint",
"smallint": "smallint",
"int": "integer",
"bigint": "bigint",
"decimal": "decimal",
"numeric": "numeric",
"float": "double precision",
"real": "real",
"money": "money",
"smallmoney": "money",
"char": "char",
"varchar": "varchar",
"text": "text",
"nchar": "char",
"nvarchar": "varchar",
"ntext": "text",
"binary": "bytea",
"varbinary": "bytea",
"image": "bytea",
"datetime": "timestamp",
"datetime2": "timestamp",
"smalldatetime": "timestamp",
"date": "date",
"time": "time",
"datetimeoffset": "timestamp with time zone",
"timestamp": "bytea",
"bit": "boolean",
"uniqueidentifier": "uuid",
"xml": "xml",
"sql_variant": "text",
}
// SQLServerToOracle Data type conversions from SQL Server to Oracle
SQLServerToOracle = map[string]string{
"tinyint": "NUMBER(3)",
"smallint": "NUMBER(5)",
"int": "NUMBER(10)",
"bigint": "NUMBER(19)",
"decimal": "NUMBER",
"numeric": "NUMBER",
"float": "FLOAT",
"real": "FLOAT",
"money": "NUMBER(19,4)",
"smallmoney": "NUMBER(10,4)",
"char": "CHAR",
"varchar": "VARCHAR2",
"text": "CLOB",
"nchar": "NCHAR",
"nvarchar": "NVARCHAR2",
"ntext": "NCLOB",
"binary": "RAW",
"varbinary": "BLOB",
"image": "BLOB",
"datetime": "TIMESTAMP",
"datetime2": "TIMESTAMP",
"smalldatetime": "TIMESTAMP",
"date": "DATE",
"time": "TIMESTAMP",
"datetimeoffset": "TIMESTAMP WITH TIME ZONE",
"timestamp": "RAW(8)",
"bit": "NUMBER(1)",
"uniqueidentifier": "RAW(16)",
"xml": "XMLTYPE",
"sql_variant": "CLOB",
}
// SQLServerToSQLite Data type conversions from SQL Server to SQLite
SQLServerToSQLite = map[string]string{
"tinyint": "INTEGER",
"smallint": "INTEGER",
"int": "INTEGER",
"bigint": "INTEGER",
"decimal": "REAL",
"numeric": "REAL",
"float": "REAL",
"real": "REAL",
"money": "REAL",
"smallmoney": "REAL",
"char": "TEXT",
"varchar": "TEXT",
"text": "TEXT",
"nchar": "TEXT",
"nvarchar": "TEXT",
"ntext": "TEXT",
"binary": "BLOB",
"varbinary": "BLOB",
"image": "BLOB",
"datetime": "TEXT",
"datetime2": "TEXT",
"smalldatetime": "TEXT",
"date": "TEXT",
"time": "TEXT",
"datetimeoffset": "TEXT",
"timestamp": "BLOB",
"bit": "INTEGER",
"uniqueidentifier": "TEXT",
"xml": "TEXT",
"sql_variant": "TEXT",
}
)