sql
--
CREATE TABLE all_types_bcp_unittest (
	  not_null_bit			bit NOT NULL

	, not_null_char			char(10) NOT NULL
	, not_null_varchar		varchar(10) NOT NULL

	, not_null_datetime		datetime NOT NULL
	, not_null_smalldatetime	smalldatetime NOT NULL

	, not_null_money		money NOT NULL
	, not_null_smallmoney		smallmoney NOT NULL

	, not_null_float		float NOT NULL
	, not_null_real			real NOT NULL

	, not_null_decimal		decimal(5,2) NOT NULL
	, not_null_numeric		numeric(5,2) NOT NULL

	, not_null_int			int NOT NULL
	, not_null_smallint		smallint NOT NULL
	, not_null_tinyint		tinyint NOT NULL

	, nullable_char			char(10)  NULL
	, nullable_varchar		varchar(10)  NULL

	, nullable_datetime		datetime  NULL
	, nullable_smalldatetime	smalldatetime  NULL

	, nullable_money		money  NULL
	, nullable_smallmoney		smallmoney  NULL

	, nullable_float		float  NULL
	, nullable_real			real  NULL

	, nullable_decimal		decimal(5,2)  NULL
	, nullable_numeric		numeric(5,2)  NULL

	, nullable_int			int  NULL
	, nullable_smallint		smallint  NULL
	, nullable_tinyint		tinyint  NULL

	/* Excludes:
	 * binary
	 * image
	 * uniqueidentifier
	 * varbinary
	 * text
	 * timestamp
	 * nchar
	 * ntext
	 * nvarchar
	 */
)

INSERT all_types_bcp_unittest
VALUES ( 1 -- not_null_bit

	, 'a' -- not_null_char
	, 'a' -- not_null_varchar

	, 'Dec 17 2003  3:44PM' -- not_null_datetime
	, 'Dec 17 2003  3:44PM' -- not_null_smalldatetime

	, 12.34 -- not_null_money
	, 12.34 -- not_null_smallmoney

	, 12.34 -- not_null_float
	, 12.34 -- not_null_real

	, 12.34 -- not_null_decimal
	, 12.34 -- not_null_numeric

	, 1234 -- not_null_int
	, 1234 -- not_null_smallint
	, 123  -- not_null_tinyint

	, 'a' -- nullable_char
	, 'a' -- nullable_varchar

	, 'Dec 17 2003  3:44PM' -- nullable_datetime
	, 'Dec 17 2003  3:44PM' -- nullable_smalldatetime

	, 12.34 -- nullable_money
	, 12.34 -- nullable_smallmoney

	, 12.34 -- nullable_float
	, 12.34 -- nullable_real

	, 12.34 -- nullable_decimal
	, 12.34 -- nullable_numeric

	, 1234 -- nullable_int
	, 1234 -- nullable_smallint
	, 123  -- nullable_tinyint
)
INSERT all_types_bcp_unittest
				( not_null_bit

				, not_null_char
				, not_null_varchar

				, not_null_datetime
				, not_null_smalldatetime

				, not_null_money
				, not_null_smallmoney

				, not_null_float
				, not_null_real

				, not_null_decimal
				, not_null_numeric

				, not_null_int
				, not_null_smallint
				, not_null_tinyint
				)
VALUES (
	  1 -- not_null_bit

	, 'a' -- not_null_char
	, 'a' -- not_null_varchar

	, 'Dec 17 2003  3:44PM' -- not_null_datetime
	, 'Dec 17 2003  3:44PM' -- not_null_smalldatetime

	, 12.34 -- not_null_money
	, 12.34 -- not_null_smallmoney

	, 12.34 -- not_null_float
	, 12.34 -- not_null_real

	, 12.34 -- not_null_decimal
	, 12.34 -- not_null_numeric

	, 1234 -- not_null_int
	, 1234 -- not_null_smallint
	, 123  -- not_null_tinyint
)
--
bind
--
not_null_bit
not_null_char
not_null_varchar
not_null_datetime
not_null_smalldatetime
not_null_money
not_null_smallmoney
not_null_float
not_null_real
not_null_decimal
not_null_numeric
not_null_int
not_null_smallint
not_null_tinyint
null_char
null_varchar
null_datetime
null_smalldatetime
null_money
null_smallmoney
null_float
null_real
null_decimal
null_numeric
null_int
null_smallint
null_tinyint
--
output
--
1
a char    
a varchar
Dec 17 2003  3:44PM
Dec 17 2003  3:44PM
12.3400
12.3400
12.34
12.3400002
12.34
12.34
1234
1234
123
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
--
sql
--
CREATE TABLE all_types_bcp_unittest (
	  not_null_varbinary		varbinary(10) NOT NULL
)
--
bind
--
not_null_varbinary
--
output
--
313233343536373839
--
sql
--
CREATE TABLE all_types_bcp_unittest (
	  not_null_bit			bit NOT NULL

	, not_null_char			char(10) NOT NULL
	, not_null_varchar		varchar(10) NOT NULL

	, not_null_datetime		datetime NOT NULL
	, not_null_smalldatetime	smalldatetime NOT NULL

	, not_null_money		money NOT NULL
	, not_null_smallmoney		smallmoney NOT NULL

	, not_null_float		float NOT NULL
	, not_null_real			real NOT NULL

	, not_null_decimal		decimal(5,2) NOT NULL
	, not_null_numeric		numeric(5,2) NOT NULL

	, not_null_int			int NOT NULL
	, not_null_smallint		smallint NOT NULL
	, not_null_tinyint		tinyint NOT NULL

	, nullable_char			char(10)  NULL
	, nullable_varchar		varchar(10)  NULL

	, nullable_datetime		datetime  NULL
	, nullable_smalldatetime	smalldatetime  NULL

	, nullable_money		money  NULL
	, nullable_smallmoney		smallmoney  NULL

	, nullable_float		float  NULL
	, nullable_real			real  NULL

	, nullable_decimal		decimal(5,2)  NULL
	, nullable_numeric		numeric(5,2)  NULL

	, nullable_int			int  NULL
	, nullable_smallint		smallint  NULL
	, nullable_tinyint		tinyint  NULL

	/* Excludes:
	 * binary
	 * image
	 * uniqueidentifier
	 * varbinary
	 * text
	 * timestamp
	 * nchar
	 * ntext
	 * nvarchar
	 */
)
lock datarows

INSERT all_types_bcp_unittest
VALUES ( 1 -- not_null_bit

	, 'a' -- not_null_char
	, 'a' -- not_null_varchar

	, 'Dec 17 2003  3:44PM' -- not_null_datetime
	, 'Dec 17 2003  3:44PM' -- not_null_smalldatetime

	, 12.34 -- not_null_money
	, 12.34 -- not_null_smallmoney

	, 12.34 -- not_null_float
	, 12.34 -- not_null_real

	, 12.34 -- not_null_decimal
	, 12.34 -- not_null_numeric

	, 1234 -- not_null_int
	, 1234 -- not_null_smallint
	, 123  -- not_null_tinyint

	, 'a' -- nullable_char
	, 'a' -- nullable_varchar

	, 'Dec 17 2003  3:44PM' -- nullable_datetime
	, 'Dec 17 2003  3:44PM' -- nullable_smalldatetime

	, 12.34 -- nullable_money
	, 12.34 -- nullable_smallmoney

	, 12.34 -- nullable_float
	, 12.34 -- nullable_real

	, 12.34 -- nullable_decimal
	, 12.34 -- nullable_numeric

	, 1234 -- nullable_int
	, 1234 -- nullable_smallint
	, 123  -- nullable_tinyint
)
INSERT all_types_bcp_unittest
				( not_null_bit

				, not_null_char
				, not_null_varchar

				, not_null_datetime
				, not_null_smalldatetime

				, not_null_money
				, not_null_smallmoney

				, not_null_float
				, not_null_real

				, not_null_decimal
				, not_null_numeric

				, not_null_int
				, not_null_smallint
				, not_null_tinyint
				)
VALUES (
	  1 -- not_null_bit

	, 'a' -- not_null_char
	, 'a' -- not_null_varchar

	, 'Dec 17 2003  3:44PM' -- not_null_datetime
	, 'Dec 17 2003  3:44PM' -- not_null_smalldatetime

	, 12.34 -- not_null_money
	, 12.34 -- not_null_smallmoney

	, 12.34 -- not_null_float
	, 12.34 -- not_null_real

	, 12.34 -- not_null_decimal
	, 12.34 -- not_null_numeric

	, 1234 -- not_null_int
	, 1234 -- not_null_smallint
	, 123  -- not_null_tinyint
)
--
bind
--
not_null_bit
not_null_char
not_null_varchar
not_null_datetime
not_null_smalldatetime
not_null_money
not_null_smallmoney
not_null_float
not_null_real
not_null_decimal
not_null_numeric
not_null_int
not_null_smallint
not_null_tinyint
null_char
null_varchar
null_datetime
null_smalldatetime
null_money
null_smallmoney
null_float
null_real
null_decimal
null_numeric
null_int
null_smallint
null_tinyint
--
output
--
1
a char    
a varchar
Dec 17 2003  3:44PM
Dec 17 2003  3:44PM
12.3400
12.3400
12.34
12.3400002
12.34
12.34
1234
1234
123
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
--
sql
--
CREATE TABLE all_types_bcp_unittest (
	si smallint NOT NULL
)
--
bind
--
CS_CHAR_TYPE	10	123
SENDROW
-- truncated data
CS_CHAR_TYPE	10	hello
SENDROWERROR	CLIENT	0x102011a	Failed in conversion routine - syntax error.  col = 1 row = 2
CS_CHAR_TYPE	10	12345678
SENDROWERROR	CLIENT	0x1020119	Failed in conversion routine - condition overflow.  col = 1 row = 2
CS_CHAR_TYPE	10	45
--
output
--
123
45
--
end

