This question is locked. New answers and comments are not allowed.
I am using MS SQL 2008 R2 database. I am doing a batch insert of records. However, most of data values were truncated during the insert. It looks like that OA creates a SQL statement based on the length of data (from the first record in the batch) and not based on the length of the field specified in database.
Here is the code taken from the OA context class:
Here is the SQL statement generated by OA for the first record in the batch (taken form SQL Profiler).
Here is the SQL statement for the second record from the batch:
Thank you for your help.
Here is the code taken from the OA context class:
[Column(
"addressto"
, OpenAccessType = OpenAccessType.Character, IsNullable =
true
, Length = 100, Scale = 0, SqlType =
"char"
)]
Here is the SQL statement generated by OA for the first record in the batch (taken form SQL Profiler).
declare
@p1
int
set
@p1=1
exec
sp_prepexec @p1
output
,N
'@p0 nvarchar(20),@p1 nvarchar(22),@p2 nvarchar(16),@p3 datetime,@p4 int,@p5 nvarchar(24),@p6 nvarchar(10),@p7 nvarchar(9),@p8 nvarchar(61),@p9 nvarchar(17)'
,N'
INSERT
INTO
[ETM_Log] ([addressfrom], [addressto], [etm_span_recid], [emaildate], [issuccess], [namefrom], [nameto], [student_id], [subject], [defuserid])
VALUES
(@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9)
Here is the SQL statement for the second record from the batch:
exec
sp_execute 1,@p0=N
''
,@p1=N
''
,@p2=N
''
,@p3=
'2012-03-05 15:39:30.710'
,@p4=1,@p5=N
''
,@p6=N
''
,@p7=N
''
,@p8=N
''
,@p9=N
''
Thank you for your help.