Saving long strings into sqlserver
Saving long strings into sqlserver
TD 5.1 PTF2 . SqlServer 2000 SP3
When we try to write a longstring field to a ntext field on sqlserver we get the following error indicating a length mismatch.
" Number: 20029 Error Command: C:\Program Files\Unify\Team Developer 5.1\error.sql Error was [Microsoft][ODBC SQL Server Driver]String data, length mismatch "
If we change the source definition and make the subject eg sText of the insert just a string , then the insert works . We have tried setting the long type first but it seems to make no difference.
Call SqlPrepareAndExecute(hSql, ' DELETE FROM LS_TABLE ' )
If SqlPrepare ( hSql, ' INSERT INTO LS_TABLE ( LS_TEXT ) VaLUES ( :sText ) ' )
If SqlSetLongBindDatatype( 5, 22)
If SqlExecute(hSql)
Call SalMessageBox( 'Success' , ' inserted' , MB_Ok)
Else
Call SalMessageBox( 'Failed on Execute ' , ' inserted' , MB_Ok)
Else
Call SalMessageBox( 'Failed on Set Long data type ' , ' inserted' , MB_Ok)
Else
Call SalMessageBox( 'Failed on Prepare ' , ' inserted' , MB_Ok)
Call SqlCommit(hSql)
Call SqlDisconnect ( hSql)
DOes anyone know if this is a permanent change , eg to use strings and not longstring !
cheers RWA
When we try to write a longstring field to a ntext field on sqlserver we get the following error indicating a length mismatch.
" Number: 20029 Error Command: C:\Program Files\Unify\Team Developer 5.1\error.sql Error was [Microsoft][ODBC SQL Server Driver]String data, length mismatch "
If we change the source definition and make the subject eg sText of the insert just a string , then the insert works . We have tried setting the long type first but it seems to make no difference.
Call SqlPrepareAndExecute(hSql, ' DELETE FROM LS_TABLE ' )
If SqlPrepare ( hSql, ' INSERT INTO LS_TABLE ( LS_TEXT ) VaLUES ( :sText ) ' )
If SqlSetLongBindDatatype( 5, 22)
If SqlExecute(hSql)
Call SalMessageBox( 'Success' , ' inserted' , MB_Ok)
Else
Call SalMessageBox( 'Failed on Execute ' , ' inserted' , MB_Ok)
Else
Call SalMessageBox( 'Failed on Set Long data type ' , ' inserted' , MB_Ok)
Else
Call SalMessageBox( 'Failed on Prepare ' , ' inserted' , MB_Ok)
Call SqlCommit(hSql)
Call SqlDisconnect ( hSql)
DOes anyone know if this is a permanent change , eg to use strings and not longstring !
cheers RWA
Re: Saving long strings into sqlserver
Hi Roger,
Do I understand you well you are saying you have problem if you use LONG STRING and NOT STRING is that correct?
If that the case this is in contradiction of the CCOD.PDF manual in TD 5.1 page 3-3. We don't talk about NTEXT but would assume it be the same as with TEXT
here it says
LONG STRING
BINARY (8000 or fewer bytes)
CHAR (8000 or fewer bytes)
IMAGE
TEXT
VARBINARY (8000 or fewer bytes)
VARCHAR (8000 or fewer bytes)
so let me check that...
Cheers
JM
Do I understand you well you are saying you have problem if you use LONG STRING and NOT STRING is that correct?
If that the case this is in contradiction of the CCOD.PDF manual in TD 5.1 page 3-3. We don't talk about NTEXT but would assume it be the same as with TEXT
here it says
LONG STRING
BINARY (8000 or fewer bytes)
CHAR (8000 or fewer bytes)
IMAGE
TEXT
VARBINARY (8000 or fewer bytes)
VARCHAR (8000 or fewer bytes)
Good question, if that would be the manual would get a bug...DOes anyone know if this is a permanent change , eg to use strings and not longstring !
so let me check that...
Cheers
JM
Re: Saving long strings into sqlserver
Hi again,
Normally SqlSetLongBindDatatype( 5, 22) is not needed AFAIK for TEXT as it is the default...
I assume you try without?
JM
Normally SqlSetLongBindDatatype( 5, 22) is not needed AFAIK for TEXT as it is the default...
I assume you try without?
JM
Re: Saving long strings into sqlserver
HI JM
Yes what I am saying that if i use a longstring when trying to insert a record I get the error . If I just use a string I dont get the error and the insert works - even if the string is > 4000 bytes.
If I set the parameter it doesnt make any difference - with a long string it still doesnt work - with a string it works with or without the parameter.
The manual indicates that I should be using a longstring
I attached a small test app cheers Roger
Yes what I am saying that if i use a longstring when trying to insert a record I get the error . If I just use a string I dont get the error and the insert works - even if the string is > 4000 bytes.
If I set the parameter it doesnt make any difference - with a long string it still doesnt work - with a string it works with or without the parameter.
The manual indicates that I should be using a longstring
I attached a small test app cheers Roger
You do not have the required permissions to view the files attached to this post.
Re: Saving long strings into sqlserver
Hi,
Just to let you know I'm looking into this and see indeed problem...but also with TD 4.2 and this confuses me.
I should let you know soon. I'm using curretnly my own testcase with OLEDB no problem with ODBC I have odd issues...
I will check your testcase as well. The question though, is assuming you can insert with STRING up to 4000 which I could test indeed....
Are you sure your data inserted are OK, also can you fecht with long strings? this is where I have problem, don't you have any truncations?
JM
Just to let you know I'm looking into this and see indeed problem...but also with TD 4.2 and this confuses me.
I should let you know soon. I'm using curretnly my own testcase with OLEDB no problem with ODBC I have odd issues...
I will check your testcase as well. The question though, is assuming you can insert with STRING up to 4000 which I could test indeed....
Are you sure your data inserted are OK, also can you fecht with long strings? this is where I have problem, don't you have any truncations?
JM
Re: Saving long strings into sqlserver
Hi
I entered TD-4727 for this issue.
Thanks for your report.
JM
I entered TD-4727 for this issue.
Thanks for your report.
JM
Re: Saving long strings into sqlserver
I know, this is an very old thread, but I just came across this error when updateing our 4.1 application with the sqlncli drivers for SQLServer 2008.
Have there been any fixes to this error?
Thanks in advance
Wilhelm
Have there been any fixes to this error?
Thanks in advance
Wilhelm
Re: Saving long strings into sqlserver
Hi,
In SqlSetLongBindDatatype( nBindVarNumber,nDatatype ) wes should give the nBindVarNumber correctly.
Use 1 to set the first bind variable and 2 for second variable and so on..
i hope may be this will be wrong.
And also check there is no other sql statements not runs.
Regards
Sudhakar G
In SqlSetLongBindDatatype( nBindVarNumber,nDatatype ) wes should give the nBindVarNumber correctly.
Use 1 to set the first bind variable and 2 for second variable and so on..
i hope may be this will be wrong.
And also check there is no other sql statements not runs.
Regards
Sudhakar G
Re: Saving long strings into sqlserver
Sorry, but I really don't understand what you are trying to say.
Wilhelm
Wilhelm
Re: Saving long strings into sqlserver
Hi,
Sorry
at first please check the parameters of SqlSetLongBindDatatype( nBindVarNumber,nDatatype ). and give it correctly or is it possible to show your sample code?
regards
Sudhakar G
Sorry
at first please check the parameters of SqlSetLongBindDatatype( nBindVarNumber,nDatatype ). and give it correctly or is it possible to show your sample code?
regards
Sudhakar G
Who is online
Users browsing this forum: [Ccbot] and 0 guests