tiny_tds 0.4.5.rc1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,138 @@
1
+
2
+ /*
3
+
4
+ * Binary Data - Our test binary data is a 1 pixel gif. The basic (raw) data is below. Quoting this data
5
+ would involve this (encode) method and be (encoded) with the 0x prefix for raw SQL. In other clients the
6
+ (raw_db) value without the 0x prefix would need to be (packed) again yield the original (raw) value.
7
+
8
+ (raw) - "GIF89a\001\000\001\000\221\000\000\377\377\377\377\377\377\376\001\002\000\000\000!\371\004\004\024\000\377\000,\000\000\000\000\001\000\001\000\000\002\002D\001\000;"
9
+ (encode) - "0x#{raw.unpack("H*")[0]}"
10
+ (encoded) - "0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b"
11
+ (raw_db) - "47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b"
12
+ (packed) - [raw_db].pack('H*')
13
+
14
+ */
15
+
16
+ CREATE TABLE [dbo].[datatypes] (
17
+ [id] [int] NOT NULL IDENTITY(1,1) PRIMARY KEY,
18
+ [bigint] [bigint] NULL,
19
+ [binary_50] [binary](50) NULL,
20
+ [bit] [bit] NULL,
21
+ [char_10] [char](10) NULL,
22
+ -- [date] [date] NULL,
23
+ [datetime] [datetime] NULL,
24
+ -- [datetime2_7] [datetime2](7) NULL,
25
+ -- [datetimeoffset_2] [datetimeoffset](2) NULL,
26
+ -- [datetimeoffset_7] [datetimeoffset](7) NULL,
27
+ [decimal_9_2] [decimal](9, 2) NULL,
28
+ [decimal_16_4] [decimal](16, 4) NULL,
29
+ [float] [float] NULL,
30
+ -- [geography] [geography] NULL,
31
+ -- [geometry] [geometry] NULL,
32
+ -- [hierarchyid] [hierarchyid] NULL,
33
+ [image] [image] NULL,
34
+ [int] [int] NULL,
35
+ [money] [money] NULL,
36
+ [nchar_10] [nchar](10) NULL,
37
+ [ntext] [ntext] NULL,
38
+ [numeric_18_0] [numeric](18, 0) NULL,
39
+ [numeric_36_2] [numeric](36, 2) NULL,
40
+ [nvarchar_50] [nvarchar](50) NULL,
41
+ [nvarchar_max] [nvarchar](max) NULL,
42
+ [real] [real] NULL,
43
+ [smalldatetime] [smalldatetime] NULL,
44
+ [smallint] [smallint] NULL,
45
+ [smallmoney] [smallmoney] NULL,
46
+ [text] [text] NULL,
47
+ -- [time_2] [time](2) NULL,
48
+ -- [time_7] [time](7) NULL,
49
+ [timestamp] [timestamp] NULL,
50
+ [tinyint] [tinyint] NULL,
51
+ [uniqueidentifier] [uniqueidentifier] NULL,
52
+ [varbinary_50] [varbinary](50) NULL,
53
+ [varbinary_max] [varbinary](max) NULL,
54
+ [varchar_50] [varchar](50) NULL,
55
+ [varchar_max] [varchar](max) NULL,
56
+ [xml] [xml] NULL
57
+ ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
58
+
59
+ SET IDENTITY_INSERT [datatypes] ON
60
+
61
+ INSERT INTO [datatypes] ([id], [bigint]) VALUES ( 11, -9223372036854775807 )
62
+ INSERT INTO [datatypes] ([id], [bigint]) VALUES ( 12, 9223372036854775806 )
63
+ INSERT INTO [datatypes] ([id], [binary_50]) VALUES ( 21, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
64
+ INSERT INTO [datatypes] ([id], [bit]) VALUES ( 31, 1 )
65
+ INSERT INTO [datatypes] ([id], [bit]) VALUES ( 32, 0 )
66
+ INSERT INTO [datatypes] ([id], [char_10]) VALUES ( 41, '1234567890' )
67
+ INSERT INTO [datatypes] ([id], [char_10]) VALUES ( 42, '12345678' )
68
+ -- INSERT INTO [datatypes] ([id], [date]) VALUES ( 51, '0001-01-01' )
69
+ -- INSERT INTO [datatypes] ([id], [date]) VALUES ( 52, '9999-12-31' )
70
+ INSERT INTO [datatypes] ([id], [datetime]) VALUES ( 61, '1753-01-01T00:00:00.000' )
71
+ INSERT INTO [datatypes] ([id], [datetime]) VALUES ( 62, '9999-12-31T23:59:59.997' )
72
+ INSERT INTO [datatypes] ([id], [datetime]) VALUES ( 63, '2010-01-01T12:34:56.123' )
73
+ -- INSERT INTO [datatypes] ([id], [datetime2_7]) VALUES ( 71, '0001-01-01T00:00:00.0000000Z' )
74
+ -- INSERT INTO [datatypes] ([id], [datetime2_7]) VALUES ( 72, '1984-01-24T04:20:00.0000000-08:00' )
75
+ -- INSERT INTO [datatypes] ([id], [datetime2_7]) VALUES ( 73, '9999-12-31T23:59:59.9999999Z' )
76
+ -- INSERT INTO [datatypes] ([id], [datetimeoffset_2]) VALUES ( 81, '1984-01-24T04:20:00.0000000-08:00' ) -- 1984-01-24 04:20:00.00 -08:00
77
+ -- INSERT INTO [datatypes] ([id], [datetimeoffset_2]) VALUES ( 82, '1984-01-24T04:20:00.0000000Z' ) -- 1984-01-24 04:20:00.00 +00:00
78
+ -- INSERT INTO [datatypes] ([id], [datetimeoffset_2]) VALUES ( 83, '9999-12-31T23:59:59.9999999Z' ) -- 9999-12-31 23:59:59.99 +00:00
79
+ -- INSERT INTO [datatypes] ([id], [datetimeoffset_7]) VALUES ( 84, '1984-01-24T04:20:00.0000000-08:00' ) -- 1984-01-24 04:20:00.0000000 -08:00
80
+ -- INSERT INTO [datatypes] ([id], [datetimeoffset_7]) VALUES ( 85, '1984-01-24T04:20:00.0000000Z' ) -- 1984-01-24 04:20:00.0000000 +00:00
81
+ -- INSERT INTO [datatypes] ([id], [datetimeoffset_7]) VALUES ( 86, '9999-12-31T23:59:59.9999999Z' ) -- 9999-12-31 23:59:59.9999999 +00:00
82
+ INSERT INTO [datatypes] ([id], [decimal_9_2]) VALUES ( 91, 12345.01 )
83
+ INSERT INTO [datatypes] ([id], [decimal_9_2]) VALUES ( 92, 1234567.89 )
84
+ INSERT INTO [datatypes] ([id], [decimal_16_4]) VALUES ( 93, 0.0 )
85
+ INSERT INTO [datatypes] ([id], [decimal_16_4]) VALUES ( 94, 123456789012.3456 )
86
+ INSERT INTO [datatypes] ([id], [float]) VALUES ( 101, 123.00000001 )
87
+ INSERT INTO [datatypes] ([id], [float]) VALUES ( 102, 0.0 )
88
+ INSERT INTO [datatypes] ([id], [float]) VALUES ( 103, 123.45 )
89
+ -- INSERT INTO [datatypes] ([id], [geography]) VALUES ( 111, geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326) ) -- 0xE610000001148716D9CEF7D34740D7A3703D0A975EC08716D9CEF7D34740CBA145B6F3955EC0
90
+ -- INSERT INTO [datatypes] ([id], [geometry]) VALUES ( 121, geometry::STGeomFromText('LINESTRING (100 100, 20 180, 180 180)', 0) ) -- 0x0000000001040300000000000000000059400000000000005940000000000000344000000000008066400000000000806640000000000080664001000000010000000001000000FFFFFFFF0000000002
91
+ -- INSERT INTO [datatypes] ([id], [hierarchyid]) VALUES ( 131, CAST('/1/' AS hierarchyid) ) -- 0x58
92
+ -- INSERT INTO [datatypes] ([id], [hierarchyid]) VALUES ( 132, CAST('/2/' AS hierarchyid) ) -- 0x68
93
+ INSERT INTO [datatypes] ([id], [image]) VALUES ( 141, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
94
+ INSERT INTO [datatypes] ([id], [int]) VALUES ( 151, -2147483647 )
95
+ INSERT INTO [datatypes] ([id], [int]) VALUES ( 152, 2147483646 )
96
+ INSERT INTO [datatypes] ([id], [money]) VALUES ( 161, 4.20 )
97
+ INSERT INTO [datatypes] ([id], [money]) VALUES ( 162, -922337203685477.5807 )
98
+ INSERT INTO [datatypes] ([id], [money]) VALUES ( 163, 922337203685477.5806 )
99
+ INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 171, N'1234567890' )
100
+ INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 172, N'123456åå' )
101
+ INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 173, N'abc123' )
102
+ INSERT INTO [datatypes] ([id], [ntext]) VALUES ( 181, N'test ntext' )
103
+ INSERT INTO [datatypes] ([id], [ntext]) VALUES ( 182, N'test ntext åå' )
104
+ INSERT INTO [datatypes] ([id], [numeric_18_0]) VALUES ( 191, 191 )
105
+ INSERT INTO [datatypes] ([id], [numeric_18_0]) VALUES ( 192, 123456789012345678 )
106
+ INSERT INTO [datatypes] ([id], [numeric_36_2]) VALUES ( 193, 12345678901234567890.01 )
107
+ INSERT INTO [datatypes] ([id], [numeric_36_2]) VALUES ( 194, 123.46 )
108
+ INSERT INTO [datatypes] ([id], [nvarchar_50]) VALUES ( 201, N'test nvarchar_50' )
109
+ INSERT INTO [datatypes] ([id], [nvarchar_50]) VALUES ( 202, N'test nvarchar_50 åå' )
110
+ INSERT INTO [datatypes] ([id], [nvarchar_max]) VALUES ( 211, N'test nvarchar_max' )
111
+ INSERT INTO [datatypes] ([id], [nvarchar_max]) VALUES ( 212, N'test nvarchar_max åå' )
112
+ INSERT INTO [datatypes] ([id], [real]) VALUES ( 221, 123.45 )
113
+ INSERT INTO [datatypes] ([id], [real]) VALUES ( 222, 0.0 )
114
+ INSERT INTO [datatypes] ([id], [real]) VALUES ( 223, 0.00001 )
115
+ INSERT INTO [datatypes] ([id], [smalldatetime]) VALUES ( 231, '1901-01-01T15:45:00.000Z' ) -- 1901-01-01 15:45:00
116
+ INSERT INTO [datatypes] ([id], [smalldatetime]) VALUES ( 232, '2078-06-05T04:20:00.000Z' ) -- 2078-06-05 04:20:00
117
+ INSERT INTO [datatypes] ([id], [smallint]) VALUES ( 241, -32767 )
118
+ INSERT INTO [datatypes] ([id], [smallint]) VALUES ( 242, 32766 )
119
+ INSERT INTO [datatypes] ([id], [smallmoney]) VALUES ( 251, 4.20 )
120
+ INSERT INTO [datatypes] ([id], [smallmoney]) VALUES ( 252, -214748.3647 )
121
+ INSERT INTO [datatypes] ([id], [smallmoney]) VALUES ( 253, 214748.3646 )
122
+ INSERT INTO [datatypes] ([id], [text]) VALUES ( 271, 'test text' )
123
+ -- INSERT INTO [datatypes] ([id], [time_2]) VALUES ( 281, '1901-01-01T15:45:00.0100001Z' ) -- 15:45:00.01
124
+ -- INSERT INTO [datatypes] ([id], [time_2]) VALUES ( 282, '1984-01-24T04:20:00.0000001-08:00' ) -- 04:20:00.00
125
+ -- INSERT INTO [datatypes] ([id], [time_7]) VALUES ( 283, '1901-01-01T15:45:00.0100001Z' ) -- 15:45:00.0100001
126
+ -- INSERT INTO [datatypes] ([id], [time_7]) VALUES ( 284, '1984-01-24T04:20:00.0000001-08:00' ) -- 04:20:00.0000001
127
+ INSERT INTO [datatypes] ([id], [tinyint]) VALUES ( 301, 0 )
128
+ INSERT INTO [datatypes] ([id], [tinyint]) VALUES ( 302, 255 )
129
+ INSERT INTO [datatypes] ([id], [uniqueidentifier]) VALUES ( 311, NEWID() )
130
+ INSERT INTO [datatypes] ([id], [varbinary_50]) VALUES ( 321, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
131
+ INSERT INTO [datatypes] ([id], [varbinary_max]) VALUES ( 331, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
132
+ INSERT INTO [datatypes] ([id], [varchar_50]) VALUES ( 341, 'test varchar_50' )
133
+ INSERT INTO [datatypes] ([id], [varchar_max]) VALUES ( 351, 'test varchar_max' )
134
+ INSERT INTO [datatypes] ([id], [xml]) VALUES ( 361, '<foo><bar>batz</bar></foo>' )
135
+
136
+ SET IDENTITY_INSERT [datatypes] OFF
137
+
138
+
@@ -0,0 +1,138 @@
1
+
2
+ /*
3
+
4
+ * Binary Data - Our test binary data is a 1 pixel gif. The basic (raw) data is below. Quoting this data
5
+ would involve this (encode) method and be (encoded) with the 0x prefix for raw SQL. In other clients the
6
+ (raw_db) value without the 0x prefix would need to be (packed) again yield the original (raw) value.
7
+
8
+ (raw) - "GIF89a\001\000\001\000\221\000\000\377\377\377\377\377\377\376\001\002\000\000\000!\371\004\004\024\000\377\000,\000\000\000\000\001\000\001\000\000\002\002D\001\000;"
9
+ (encode) - "0x#{raw.unpack("H*")[0]}"
10
+ (encoded) - "0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b"
11
+ (raw_db) - "47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b"
12
+ (packed) - [raw_db].pack('H*')
13
+
14
+ */
15
+
16
+ CREATE TABLE [dbo].[datatypes] (
17
+ [id] [int] NOT NULL IDENTITY(1,1) PRIMARY KEY,
18
+ [bigint] [bigint] NULL,
19
+ [binary_50] [binary](50) NULL,
20
+ [bit] [bit] NULL,
21
+ [char_10] [char](10) NULL,
22
+ [date] [date] NULL,
23
+ [datetime] [datetime] NULL,
24
+ [datetime2_7] [datetime2](7) NULL,
25
+ [datetimeoffset_2] [datetimeoffset](2) NULL,
26
+ [datetimeoffset_7] [datetimeoffset](7) NULL,
27
+ [decimal_9_2] [decimal](9, 2) NULL,
28
+ [decimal_16_4] [decimal](16, 4) NULL,
29
+ [float] [float] NULL,
30
+ [geography] [geography] NULL,
31
+ [geometry] [geometry] NULL,
32
+ [hierarchyid] [hierarchyid] NULL,
33
+ [image] [image] NULL,
34
+ [int] [int] NULL,
35
+ [money] [money] NULL,
36
+ [nchar_10] [nchar](10) NULL,
37
+ [ntext] [ntext] NULL,
38
+ [numeric_18_0] [numeric](18, 0) NULL,
39
+ [numeric_36_2] [numeric](36, 2) NULL,
40
+ [nvarchar_50] [nvarchar](50) NULL,
41
+ [nvarchar_max] [nvarchar](max) NULL,
42
+ [real] [real] NULL,
43
+ [smalldatetime] [smalldatetime] NULL,
44
+ [smallint] [smallint] NULL,
45
+ [smallmoney] [smallmoney] NULL,
46
+ [text] [text] NULL,
47
+ [time_2] [time](2) NULL,
48
+ [time_7] [time](7) NULL,
49
+ [timestamp] [timestamp] NULL,
50
+ [tinyint] [tinyint] NULL,
51
+ [uniqueidentifier] [uniqueidentifier] NULL,
52
+ [varbinary_50] [varbinary](50) NULL,
53
+ [varbinary_max] [varbinary](max) NULL,
54
+ [varchar_50] [varchar](50) NULL,
55
+ [varchar_max] [varchar](max) NULL,
56
+ [xml] [xml] NULL
57
+ ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
58
+
59
+ SET IDENTITY_INSERT [datatypes] ON
60
+
61
+ INSERT INTO [datatypes] ([id], [bigint]) VALUES ( 11, -9223372036854775807 )
62
+ INSERT INTO [datatypes] ([id], [bigint]) VALUES ( 12, 9223372036854775806 )
63
+ INSERT INTO [datatypes] ([id], [binary_50]) VALUES ( 21, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
64
+ INSERT INTO [datatypes] ([id], [bit]) VALUES ( 31, 1 )
65
+ INSERT INTO [datatypes] ([id], [bit]) VALUES ( 32, 0 )
66
+ INSERT INTO [datatypes] ([id], [char_10]) VALUES ( 41, '1234567890' )
67
+ INSERT INTO [datatypes] ([id], [char_10]) VALUES ( 42, '12345678' )
68
+ INSERT INTO [datatypes] ([id], [date]) VALUES ( 51, '0001-01-01' )
69
+ INSERT INTO [datatypes] ([id], [date]) VALUES ( 52, '9999-12-31' )
70
+ INSERT INTO [datatypes] ([id], [datetime]) VALUES ( 61, '1753-01-01T00:00:00.000' )
71
+ INSERT INTO [datatypes] ([id], [datetime]) VALUES ( 62, '9999-12-31T23:59:59.997' )
72
+ INSERT INTO [datatypes] ([id], [datetime]) VALUES ( 63, '2010-01-01T12:34:56.123' )
73
+ INSERT INTO [datatypes] ([id], [datetime2_7]) VALUES ( 71, '0001-01-01T00:00:00.0000000Z' )
74
+ INSERT INTO [datatypes] ([id], [datetime2_7]) VALUES ( 72, '1984-01-24T04:20:00.0000000-08:00' )
75
+ INSERT INTO [datatypes] ([id], [datetime2_7]) VALUES ( 73, '9999-12-31T23:59:59.9999999Z' )
76
+ INSERT INTO [datatypes] ([id], [datetimeoffset_2]) VALUES ( 81, '1984-01-24T04:20:00.0000000-08:00' ) -- 1984-01-24 04:20:00.00 -08:00
77
+ INSERT INTO [datatypes] ([id], [datetimeoffset_2]) VALUES ( 82, '1984-01-24T04:20:00.0000000Z' ) -- 1984-01-24 04:20:00.00 +00:00
78
+ INSERT INTO [datatypes] ([id], [datetimeoffset_2]) VALUES ( 83, '9999-12-31T23:59:59.9999999Z' ) -- 9999-12-31 23:59:59.99 +00:00
79
+ INSERT INTO [datatypes] ([id], [datetimeoffset_7]) VALUES ( 84, '1984-01-24T04:20:00.0000000-08:00' ) -- 1984-01-24 04:20:00.0000000 -08:00
80
+ INSERT INTO [datatypes] ([id], [datetimeoffset_7]) VALUES ( 85, '1984-01-24T04:20:00.0000000Z' ) -- 1984-01-24 04:20:00.0000000 +00:00
81
+ INSERT INTO [datatypes] ([id], [datetimeoffset_7]) VALUES ( 86, '9999-12-31T23:59:59.9999999Z' ) -- 9999-12-31 23:59:59.9999999 +00:00
82
+ INSERT INTO [datatypes] ([id], [decimal_9_2]) VALUES ( 91, 12345.01 )
83
+ INSERT INTO [datatypes] ([id], [decimal_9_2]) VALUES ( 92, 1234567.89 )
84
+ INSERT INTO [datatypes] ([id], [decimal_16_4]) VALUES ( 93, 0.0 )
85
+ INSERT INTO [datatypes] ([id], [decimal_16_4]) VALUES ( 94, 123456789012.3456 )
86
+ INSERT INTO [datatypes] ([id], [float]) VALUES ( 101, 123.00000001 )
87
+ INSERT INTO [datatypes] ([id], [float]) VALUES ( 102, 0.0 )
88
+ INSERT INTO [datatypes] ([id], [float]) VALUES ( 103, 123.45 )
89
+ INSERT INTO [datatypes] ([id], [geography]) VALUES ( 111, geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326) ) -- 0xE610000001148716D9CEF7D34740D7A3703D0A975EC08716D9CEF7D34740CBA145B6F3955EC0
90
+ INSERT INTO [datatypes] ([id], [geometry]) VALUES ( 121, geometry::STGeomFromText('LINESTRING (100 100, 20 180, 180 180)', 0) ) -- 0x0000000001040300000000000000000059400000000000005940000000000000344000000000008066400000000000806640000000000080664001000000010000000001000000FFFFFFFF0000000002
91
+ INSERT INTO [datatypes] ([id], [hierarchyid]) VALUES ( 131, CAST('/1/' AS hierarchyid) ) -- 0x58
92
+ INSERT INTO [datatypes] ([id], [hierarchyid]) VALUES ( 132, CAST('/2/' AS hierarchyid) ) -- 0x68
93
+ INSERT INTO [datatypes] ([id], [image]) VALUES ( 141, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
94
+ INSERT INTO [datatypes] ([id], [int]) VALUES ( 151, -2147483647 )
95
+ INSERT INTO [datatypes] ([id], [int]) VALUES ( 152, 2147483646 )
96
+ INSERT INTO [datatypes] ([id], [money]) VALUES ( 161, 4.20 )
97
+ INSERT INTO [datatypes] ([id], [money]) VALUES ( 162, -922337203685477.5807 )
98
+ INSERT INTO [datatypes] ([id], [money]) VALUES ( 163, 922337203685477.5806 )
99
+ INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 171, N'1234567890' )
100
+ INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 172, N'123456åå' )
101
+ INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 173, N'abc123' )
102
+ INSERT INTO [datatypes] ([id], [ntext]) VALUES ( 181, N'test ntext' )
103
+ INSERT INTO [datatypes] ([id], [ntext]) VALUES ( 182, N'test ntext åå' )
104
+ INSERT INTO [datatypes] ([id], [numeric_18_0]) VALUES ( 191, 191 )
105
+ INSERT INTO [datatypes] ([id], [numeric_18_0]) VALUES ( 192, 123456789012345678 )
106
+ INSERT INTO [datatypes] ([id], [numeric_36_2]) VALUES ( 193, 12345678901234567890.01 )
107
+ INSERT INTO [datatypes] ([id], [numeric_36_2]) VALUES ( 194, 123.46 )
108
+ INSERT INTO [datatypes] ([id], [nvarchar_50]) VALUES ( 201, N'test nvarchar_50' )
109
+ INSERT INTO [datatypes] ([id], [nvarchar_50]) VALUES ( 202, N'test nvarchar_50 åå' )
110
+ INSERT INTO [datatypes] ([id], [nvarchar_max]) VALUES ( 211, N'test nvarchar_max' )
111
+ INSERT INTO [datatypes] ([id], [nvarchar_max]) VALUES ( 212, N'test nvarchar_max åå' )
112
+ INSERT INTO [datatypes] ([id], [real]) VALUES ( 221, 123.45 )
113
+ INSERT INTO [datatypes] ([id], [real]) VALUES ( 222, 0.0 )
114
+ INSERT INTO [datatypes] ([id], [real]) VALUES ( 223, 0.00001 )
115
+ INSERT INTO [datatypes] ([id], [smalldatetime]) VALUES ( 231, '1901-01-01T15:45:00.000Z' ) -- 1901-01-01 15:45:00
116
+ INSERT INTO [datatypes] ([id], [smalldatetime]) VALUES ( 232, '2078-06-05T04:20:00.000Z' ) -- 2078-06-05 04:20:00
117
+ INSERT INTO [datatypes] ([id], [smallint]) VALUES ( 241, -32767 )
118
+ INSERT INTO [datatypes] ([id], [smallint]) VALUES ( 242, 32766 )
119
+ INSERT INTO [datatypes] ([id], [smallmoney]) VALUES ( 251, 4.20 )
120
+ INSERT INTO [datatypes] ([id], [smallmoney]) VALUES ( 252, -214748.3647 )
121
+ INSERT INTO [datatypes] ([id], [smallmoney]) VALUES ( 253, 214748.3646 )
122
+ INSERT INTO [datatypes] ([id], [text]) VALUES ( 271, 'test text' )
123
+ INSERT INTO [datatypes] ([id], [time_2]) VALUES ( 281, '1901-01-01T15:45:00.0100001Z' ) -- 15:45:00.01
124
+ INSERT INTO [datatypes] ([id], [time_2]) VALUES ( 282, '1984-01-24T04:20:00.0000001-08:00' ) -- 04:20:00.00
125
+ INSERT INTO [datatypes] ([id], [time_7]) VALUES ( 283, '1901-01-01T15:45:00.0100001Z' ) -- 15:45:00.0100001
126
+ INSERT INTO [datatypes] ([id], [time_7]) VALUES ( 284, '1984-01-24T04:20:00.0000001-08:00' ) -- 04:20:00.0000001
127
+ INSERT INTO [datatypes] ([id], [tinyint]) VALUES ( 301, 0 )
128
+ INSERT INTO [datatypes] ([id], [tinyint]) VALUES ( 302, 255 )
129
+ INSERT INTO [datatypes] ([id], [uniqueidentifier]) VALUES ( 311, NEWID() )
130
+ INSERT INTO [datatypes] ([id], [varbinary_50]) VALUES ( 321, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
131
+ INSERT INTO [datatypes] ([id], [varbinary_max]) VALUES ( 331, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
132
+ INSERT INTO [datatypes] ([id], [varchar_50]) VALUES ( 341, 'test varchar_50' )
133
+ INSERT INTO [datatypes] ([id], [varchar_max]) VALUES ( 351, 'test varchar_max' )
134
+ INSERT INTO [datatypes] ([id], [xml]) VALUES ( 361, '<foo><bar>batz</bar></foo>' )
135
+
136
+ SET IDENTITY_INSERT [datatypes] OFF
137
+
138
+
@@ -0,0 +1,138 @@
1
+
2
+ /*
3
+
4
+ * Binary Data - Our test binary data is a 1 pixel gif. The basic (raw) data is below. Quoting this data
5
+ would involve this (encode) method and be (encoded) with the 0x prefix for raw SQL. In other clients the
6
+ (raw_db) value without the 0x prefix would need to be (packed) again yield the original (raw) value.
7
+
8
+ (raw) - "GIF89a\001\000\001\000\221\000\000\377\377\377\377\377\377\376\001\002\000\000\000!\371\004\004\024\000\377\000,\000\000\000\000\001\000\001\000\000\002\002D\001\000;"
9
+ (encode) - "0x#{raw.unpack("H*")[0]}"
10
+ (encoded) - "0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b"
11
+ (raw_db) - "47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b"
12
+ (packed) - [raw_db].pack('H*')
13
+
14
+ */
15
+
16
+ CREATE TABLE [dbo].[datatypes] (
17
+ [id] [int] NOT NULL IDENTITY(1,1) PRIMARY KEY,
18
+ [bigint] [bigint] NULL,
19
+ [binary_50] [binary](50) NULL,
20
+ [bit] [bit] NULL,
21
+ [char_10] [char](10) NULL,
22
+ [date] [date] NULL,
23
+ [datetime] [datetime] NULL,
24
+ [datetime2_7] [datetime2](7) NULL,
25
+ [datetimeoffset_2] [datetimeoffset](2) NULL,
26
+ [datetimeoffset_7] [datetimeoffset](7) NULL,
27
+ [decimal_9_2] [decimal](9, 2) NULL,
28
+ [decimal_16_4] [decimal](16, 4) NULL,
29
+ [float] [float] NULL,
30
+ [geography] [geography] NULL,
31
+ [geometry] [geometry] NULL,
32
+ [hierarchyid] [hierarchyid] NULL,
33
+ [image] [image] NULL,
34
+ [int] [int] NULL,
35
+ [money] [money] NULL,
36
+ [nchar_10] [nchar](10) NULL,
37
+ [ntext] [ntext] NULL,
38
+ [numeric_18_0] [numeric](18, 0) NULL,
39
+ [numeric_36_2] [numeric](36, 2) NULL,
40
+ [nvarchar_50] [nvarchar](50) NULL,
41
+ [nvarchar_max] [nvarchar](max) NULL,
42
+ [real] [real] NULL,
43
+ [smalldatetime] [smalldatetime] NULL,
44
+ [smallint] [smallint] NULL,
45
+ [smallmoney] [smallmoney] NULL,
46
+ [text] [text] NULL,
47
+ [time_2] [time](2) NULL,
48
+ [time_7] [time](7) NULL,
49
+ [timestamp] [timestamp] NULL,
50
+ [tinyint] [tinyint] NULL,
51
+ [uniqueidentifier] [uniqueidentifier] NULL,
52
+ [varbinary_50] [varbinary](50) NULL,
53
+ [varbinary_max] [varbinary](max) NULL,
54
+ [varchar_50] [varchar](50) NULL,
55
+ [varchar_max] [varchar](max) NULL,
56
+ [xml] [xml] NULL
57
+ )
58
+
59
+ SET IDENTITY_INSERT [datatypes] ON
60
+
61
+ INSERT INTO [datatypes] ([id], [bigint]) VALUES ( 11, -9223372036854775807 )
62
+ INSERT INTO [datatypes] ([id], [bigint]) VALUES ( 12, 9223372036854775806 )
63
+ INSERT INTO [datatypes] ([id], [binary_50]) VALUES ( 21, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
64
+ INSERT INTO [datatypes] ([id], [bit]) VALUES ( 31, 1 )
65
+ INSERT INTO [datatypes] ([id], [bit]) VALUES ( 32, 0 )
66
+ INSERT INTO [datatypes] ([id], [char_10]) VALUES ( 41, '1234567890' )
67
+ INSERT INTO [datatypes] ([id], [char_10]) VALUES ( 42, '12345678' )
68
+ INSERT INTO [datatypes] ([id], [date]) VALUES ( 51, '0001-01-01' )
69
+ INSERT INTO [datatypes] ([id], [date]) VALUES ( 52, '9999-12-31' )
70
+ INSERT INTO [datatypes] ([id], [datetime]) VALUES ( 61, '1753-01-01T00:00:00.000' )
71
+ INSERT INTO [datatypes] ([id], [datetime]) VALUES ( 62, '9999-12-31T23:59:59.997' )
72
+ INSERT INTO [datatypes] ([id], [datetime]) VALUES ( 63, '2010-01-01T12:34:56.123' )
73
+ INSERT INTO [datatypes] ([id], [datetime2_7]) VALUES ( 71, '0001-01-01T00:00:00.0000000Z' )
74
+ INSERT INTO [datatypes] ([id], [datetime2_7]) VALUES ( 72, '1984-01-24T04:20:00.0000000-08:00' )
75
+ INSERT INTO [datatypes] ([id], [datetime2_7]) VALUES ( 73, '9999-12-31T23:59:59.9999999Z' )
76
+ INSERT INTO [datatypes] ([id], [datetimeoffset_2]) VALUES ( 81, '1984-01-24T04:20:00.0000000-08:00' ) -- 1984-01-24 04:20:00.00 -08:00
77
+ INSERT INTO [datatypes] ([id], [datetimeoffset_2]) VALUES ( 82, '1984-01-24T04:20:00.0000000Z' ) -- 1984-01-24 04:20:00.00 +00:00
78
+ INSERT INTO [datatypes] ([id], [datetimeoffset_2]) VALUES ( 83, '9999-12-31T23:59:59.9999999Z' ) -- 9999-12-31 23:59:59.99 +00:00
79
+ INSERT INTO [datatypes] ([id], [datetimeoffset_7]) VALUES ( 84, '1984-01-24T04:20:00.0000000-08:00' ) -- 1984-01-24 04:20:00.0000000 -08:00
80
+ INSERT INTO [datatypes] ([id], [datetimeoffset_7]) VALUES ( 85, '1984-01-24T04:20:00.0000000Z' ) -- 1984-01-24 04:20:00.0000000 +00:00
81
+ INSERT INTO [datatypes] ([id], [datetimeoffset_7]) VALUES ( 86, '9999-12-31T23:59:59.9999999Z' ) -- 9999-12-31 23:59:59.9999999 +00:00
82
+ INSERT INTO [datatypes] ([id], [decimal_9_2]) VALUES ( 91, 12345.01 )
83
+ INSERT INTO [datatypes] ([id], [decimal_9_2]) VALUES ( 92, 1234567.89 )
84
+ INSERT INTO [datatypes] ([id], [decimal_16_4]) VALUES ( 93, 0.0 )
85
+ INSERT INTO [datatypes] ([id], [decimal_16_4]) VALUES ( 94, 123456789012.3456 )
86
+ INSERT INTO [datatypes] ([id], [float]) VALUES ( 101, 123.00000001 )
87
+ INSERT INTO [datatypes] ([id], [float]) VALUES ( 102, 0.0 )
88
+ INSERT INTO [datatypes] ([id], [float]) VALUES ( 103, 123.45 )
89
+ INSERT INTO [datatypes] ([id], [geography]) VALUES ( 111, geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326) ) -- 0xE610000001148716D9CEF7D34740D7A3703D0A975EC08716D9CEF7D34740CBA145B6F3955EC0
90
+ INSERT INTO [datatypes] ([id], [geometry]) VALUES ( 121, geometry::STGeomFromText('LINESTRING (100 100, 20 180, 180 180)', 0) ) -- 0x0000000001040300000000000000000059400000000000005940000000000000344000000000008066400000000000806640000000000080664001000000010000000001000000FFFFFFFF0000000002
91
+ INSERT INTO [datatypes] ([id], [hierarchyid]) VALUES ( 131, CAST('/1/' AS hierarchyid) ) -- 0x58
92
+ INSERT INTO [datatypes] ([id], [hierarchyid]) VALUES ( 132, CAST('/2/' AS hierarchyid) ) -- 0x68
93
+ INSERT INTO [datatypes] ([id], [image]) VALUES ( 141, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
94
+ INSERT INTO [datatypes] ([id], [int]) VALUES ( 151, -2147483647 )
95
+ INSERT INTO [datatypes] ([id], [int]) VALUES ( 152, 2147483646 )
96
+ INSERT INTO [datatypes] ([id], [money]) VALUES ( 161, 4.20 )
97
+ INSERT INTO [datatypes] ([id], [money]) VALUES ( 162, -922337203685477.5807 )
98
+ INSERT INTO [datatypes] ([id], [money]) VALUES ( 163, 922337203685477.5806 )
99
+ INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 171, N'1234567890' )
100
+ INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 172, N'123456åå' )
101
+ INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 173, N'abc123' )
102
+ INSERT INTO [datatypes] ([id], [ntext]) VALUES ( 181, N'test ntext' )
103
+ INSERT INTO [datatypes] ([id], [ntext]) VALUES ( 182, N'test ntext åå' )
104
+ INSERT INTO [datatypes] ([id], [numeric_18_0]) VALUES ( 191, 191 )
105
+ INSERT INTO [datatypes] ([id], [numeric_18_0]) VALUES ( 192, 123456789012345678 )
106
+ INSERT INTO [datatypes] ([id], [numeric_36_2]) VALUES ( 193, 12345678901234567890.01 )
107
+ INSERT INTO [datatypes] ([id], [numeric_36_2]) VALUES ( 194, 123.46 )
108
+ INSERT INTO [datatypes] ([id], [nvarchar_50]) VALUES ( 201, N'test nvarchar_50' )
109
+ INSERT INTO [datatypes] ([id], [nvarchar_50]) VALUES ( 202, N'test nvarchar_50 åå' )
110
+ INSERT INTO [datatypes] ([id], [nvarchar_max]) VALUES ( 211, N'test nvarchar_max' )
111
+ INSERT INTO [datatypes] ([id], [nvarchar_max]) VALUES ( 212, N'test nvarchar_max åå' )
112
+ INSERT INTO [datatypes] ([id], [real]) VALUES ( 221, 123.45 )
113
+ INSERT INTO [datatypes] ([id], [real]) VALUES ( 222, 0.0 )
114
+ INSERT INTO [datatypes] ([id], [real]) VALUES ( 223, 0.00001 )
115
+ INSERT INTO [datatypes] ([id], [smalldatetime]) VALUES ( 231, '1901-01-01T15:45:00.000Z' ) -- 1901-01-01 15:45:00
116
+ INSERT INTO [datatypes] ([id], [smalldatetime]) VALUES ( 232, '2078-06-05T04:20:00.000Z' ) -- 2078-06-05 04:20:00
117
+ INSERT INTO [datatypes] ([id], [smallint]) VALUES ( 241, -32767 )
118
+ INSERT INTO [datatypes] ([id], [smallint]) VALUES ( 242, 32766 )
119
+ INSERT INTO [datatypes] ([id], [smallmoney]) VALUES ( 251, 4.20 )
120
+ INSERT INTO [datatypes] ([id], [smallmoney]) VALUES ( 252, -214748.3647 )
121
+ INSERT INTO [datatypes] ([id], [smallmoney]) VALUES ( 253, 214748.3646 )
122
+ INSERT INTO [datatypes] ([id], [text]) VALUES ( 271, 'test text' )
123
+ INSERT INTO [datatypes] ([id], [time_2]) VALUES ( 281, '1901-01-01T15:45:00.0100001Z' ) -- 15:45:00.01
124
+ INSERT INTO [datatypes] ([id], [time_2]) VALUES ( 282, '1984-01-24T04:20:00.0000001-08:00' ) -- 04:20:00.00
125
+ INSERT INTO [datatypes] ([id], [time_7]) VALUES ( 283, '1901-01-01T15:45:00.0100001Z' ) -- 15:45:00.0100001
126
+ INSERT INTO [datatypes] ([id], [time_7]) VALUES ( 284, '1984-01-24T04:20:00.0000001-08:00' ) -- 04:20:00.0000001
127
+ INSERT INTO [datatypes] ([id], [tinyint]) VALUES ( 301, 0 )
128
+ INSERT INTO [datatypes] ([id], [tinyint]) VALUES ( 302, 255 )
129
+ INSERT INTO [datatypes] ([id], [uniqueidentifier]) VALUES ( 311, NEWID() )
130
+ INSERT INTO [datatypes] ([id], [varbinary_50]) VALUES ( 321, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
131
+ INSERT INTO [datatypes] ([id], [varbinary_max]) VALUES ( 331, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
132
+ INSERT INTO [datatypes] ([id], [varchar_50]) VALUES ( 341, 'test varchar_50' )
133
+ INSERT INTO [datatypes] ([id], [varchar_max]) VALUES ( 351, 'test varchar_max' )
134
+ INSERT INTO [datatypes] ([id], [xml]) VALUES ( 361, '<foo><bar>batz</bar></foo>' )
135
+
136
+ SET IDENTITY_INSERT [datatypes] OFF
137
+
138
+