Hello Experts,
I have a problem with a bulk insert.
On my local machine (windows xp with a full sql 2008 r2) everything works fine.
The problem exists on the database on location with my client. (windows server 2008 with an sqlexpress 2008 r2)
my instruction is :
sql = "select * FROM " + m.y_db1 + "f_par "
retcode = SQLEXEC(handle,sql,"t_par")
IF retcode > 0
SELECT t_par
GO top
m.xxextdir = T_par.extdir
m.xxprogdir = T_par.progdir
SET defau TO &xxextdir
gnextern = ADIR(gaDatabase, '*.csv')
FOR nCount = 1 TO gnextern
m.bestand = ALLTRIM(m.xxextdir) +gaDatabase(nCount,1)
SQL = "bulk insert " + m.y_db1 + "f_extern from " +CHR(13) +;
"'" + m.bestand + "' " +;
"with (CODEPAGE ='WIDECHAR', MAXERRORS = 100,DATAFILETYPE = 'widechar',FIELDTERMINATOR = ';',ROWTERMINATOR ='\l')"
retcode = SQLEXEC(handle,sql,"")
IF retcode > 0
DELETE FILE gaDatabase(nCount,1)
ELSE
= AERROR(aErrorArray) && Data from most recent error
wait window str(aErrorArray(1),8,0) + chr(13) +;
aErrorArray(2) + chr(13) +;
'02 INSERT F_EXTERN'
return
ENDIF
ENDFOR
SET defau TO &xxprogdir
ELSE
= AERROR(aErrorArray) && Data from most recent error
wait window str(aErrorArray(1),8,0) + chr(13) +;
aErrorArray(2) + chr(13) +;
'02 SELECT T_PAR'
return
ENDIF
the problem is when i execute the bulk insert : STRING IS TOO LONG TO FIT
I hope somebody can help me out here
Wfg,
Filip
I have a problem with a bulk insert.
On my local machine (windows xp with a full sql 2008 r2) everything works fine.
The problem exists on the database on location with my client. (windows server 2008 with an sqlexpress 2008 r2)
my instruction is :
sql = "select * FROM " + m.y_db1 + "f_par "
retcode = SQLEXEC(handle,sql,"t_par")
IF retcode > 0
SELECT t_par
GO top
m.xxextdir = T_par.extdir
m.xxprogdir = T_par.progdir
SET defau TO &xxextdir
gnextern = ADIR(gaDatabase, '*.csv')
FOR nCount = 1 TO gnextern
m.bestand = ALLTRIM(m.xxextdir) +gaDatabase(nCount,1)
SQL = "bulk insert " + m.y_db1 + "f_extern from " +CHR(13) +;
"'" + m.bestand + "' " +;
"with (CODEPAGE ='WIDECHAR', MAXERRORS = 100,DATAFILETYPE = 'widechar',FIELDTERMINATOR = ';',ROWTERMINATOR ='\l')"
retcode = SQLEXEC(handle,sql,"")
IF retcode > 0
DELETE FILE gaDatabase(nCount,1)
ELSE
= AERROR(aErrorArray) && Data from most recent error
wait window str(aErrorArray(1),8,0) + chr(13) +;
aErrorArray(2) + chr(13) +;
'02 INSERT F_EXTERN'
return
ENDIF
ENDFOR
SET defau TO &xxprogdir
ELSE
= AERROR(aErrorArray) && Data from most recent error
wait window str(aErrorArray(1),8,0) + chr(13) +;
aErrorArray(2) + chr(13) +;
'02 SELECT T_PAR'
return
ENDIF
the problem is when i execute the bulk insert : STRING IS TOO LONG TO FIT
I hope somebody can help me out here
Wfg,
Filip