saving long strings into sqlserver

Discussions specific to Team Developer 5.1.

saving long strings into sqlserver

Postby RogerArmstrong » Tue May 27, 2008 6:22 pm

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
RogerArmstrong
 
Posts: 24
Joined: Tue Jul 31, 2007 7:50 pm
Location: Perth, Australia

Re: saving long strings into sqlserver

Postby jmgemperle » Wed May 28, 2008 7:41 am

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)

DOes anyone know if this is a permanent change , eg to use strings and not longstring !


Good question, if that would be the manual would get a bug...
so let me check that...

Cheers
JM
User avatar
jmgemperle
 
Posts: 886
Joined: Thu Feb 15, 2007 1:57 am
Location: Leiden The Netherlands

Re: saving long strings into sqlserver

Postby jmgemperle » Wed May 28, 2008 7:51 am

Hi again,

Normally SqlSetLongBindDatatype( 5, 22) is not needed AFAIK for TEXT as it is the default...
I assume you try without?

JM
User avatar
jmgemperle
 
Posts: 886
Joined: Thu Feb 15, 2007 1:57 am
Location: Leiden The Netherlands

Re: saving long strings into sqlserver

Postby RogerArmstrong » Wed May 28, 2008 3:29 pm

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
Testls51.zip

cheers Roger
You do not have the required permissions to view the files attached to this post.
RogerArmstrong
 
Posts: 24
Joined: Tue Jul 31, 2007 7:50 pm
Location: Perth, Australia

Re: saving long strings into sqlserver

Postby jmgemperle » Thu May 29, 2008 6:14 am

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
User avatar
jmgemperle
 
Posts: 886
Joined: Thu Feb 15, 2007 1:57 am
Location: Leiden The Netherlands

Re: saving long strings into sqlserver

Postby jmgemperle » Fri May 30, 2008 5:55 am

Hi

I entered TD-4727 for this issue.

Thanks for your report.

JM
User avatar
jmgemperle
 
Posts: 886
Joined: Thu Feb 15, 2007 1:57 am
Location: Leiden The Netherlands

Re: saving long strings into sqlserver

Postby Wilhelm » Tue Aug 13, 2013 1:53 am

I know, this is an very old thread, but I just came across this error when updateing our 4.1 aplication with the sqlncli drivers for SQLServer 2008.
Have there been any fixes to this error?

Thanks in advance

Wilhelm
Come join us at Dave Rabelink's "Team Developer Community Forum"!
All users of OpenText™ Gupta Development Tools and Databases welcome!
http://tdforum.daverabelink.net/index.php
Wilhelm
 
Posts: 32
Joined: Thu Jan 10, 2008 10:07 am

Re: saving long strings into sqlserver

Postby sudhakaruki » Thu Sep 26, 2013 3:14 am

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
sudhakaruki
 
Posts: 26
Joined: Mon Apr 15, 2013 3:08 am
Location: India - Tamilnadu

Re: saving long strings into sqlserver

Postby Wilhelm » Thu Sep 26, 2013 11:03 am

Sorry, but I really don't understand what you are trying to say.

Wilhelm
Come join us at Dave Rabelink's "Team Developer Community Forum"!
All users of OpenText™ Gupta Development Tools and Databases welcome!
http://tdforum.daverabelink.net/index.php
Wilhelm
 
Posts: 32
Joined: Thu Jan 10, 2008 10:07 am

Re: saving long strings into sqlserver

Postby sudhakaruki » Fri Sep 27, 2013 2:06 am

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
sudhakaruki
 
Posts: 26
Joined: Mon Apr 15, 2013 3:08 am
Location: India - Tamilnadu


Return to Team Developer 5.1

Who is online

Users browsing this forum: No registered users and 1 guest

cron