[SOLVED] MSS U5.0 driver producing a CAST error | Bugs, Issues and Errors | Forum

Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

—  Results per page  —








— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters
For a group of consecutive words like 'end of support' use Match phrase

sp_Feed Topic RSS sp_TopicIcon
[SOLVED] MSS U5.0 driver producing a CAST error
01 Aug 2017
10:15 am
Avatar
PaoloLovati
Member
Forum Posts: 14
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

Hi all,

a table has its primary key defined as numeric so it has NOT NULL in the database.

The key has to be filled by a db SEQUENCE, so it is left empty in the component.

When the WRITE applies the MSS drivers tries to store spaces instead of NULL in the field, producing a CAST error.

The ORA driver handles this correctly.

It looks like a bug (BUG 29424) solved for DB2 driver…

 

Uniface : [MSW] 9.6.08.02, X801

SQLServer System Information :
————————————————
Driver : sqlncli11.dll 11.00.3000
ODBC Version : 03.80.0000
Driver ODBC Version : 03.80

SQLServer2 Database Information :
————————————————
DBMS name : Microsoft SQL Server
DBMS Version : 11.00.3156

 

Thanks for any reply.

Paolo

15 Aug 2017
9:52 am
Avatar
rogerw
Member
Forum Posts: 232
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

Hi,

do you execute your SEQUENCE in the write-trigger before write?
If thats your scenario, then the trick is to set the length of the field to 0, eg.
Syntax: NED,NPR,LEN(0-0)

or as it works, you will probably set the syntax to
Syntax: HID,LEN(0-0)

Regards RogerW.

21 Aug 2017
1:42 pm
Avatar
PaoloLovati
Member
Forum Posts: 14
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

Hi RogerW,

thanks for your reply.

I tried to set the syntax of the field to HID,LEN(0-0) but the result was the same (CAST error).

The only way to make it work seems to set a value in the field before the activation of the write trigger.

Since the right value has to be set by the SEQUENCE, at db level, I set the initial value of the field to ‘0’ (avoiding, in this way, the CAST error).

A trigger INSTEAD OF, at db level, will then set the value from the SEQUENCE.

The same result can be reached, in Oracle, using a BEFORE INSERT trigger, but there is no need to force an initial value to the field, so it can be left to NULL.

Anyway… with the workaround, the problem is solved.

Regards Paolo L.

22 Aug 2017
11:05 am
Avatar
rogerw
Member
Forum Posts: 232
Member Since:
01 Oct 2012
sp_UserOfflineSmall Offline

Ok, 

from your question I somehow understood that your key was set at db level. 
I have successfully built one application where the key is always instantiated (eg. by a sequence if Sql-server version is new enough) before the write in the write-triggers.

But I understand the advantage of doing it outside Uniface and any other programming-language or sql.

 

Regards RogerW.

Forum Timezone: Europe/Amsterdam

Most Users Ever Online: 131

Currently Online:
9 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

ulrich-merkel: 1683

Iain Sharp: 605

Theo Neeskens: 339

gianni: 250

rogerw: 232

lalitpct: 197

istiller: 195

Knut: 173

-GHAN-: 171

sochaz: 165

Member Stats:

Guest Posters: 3

Members: 5469

Moderators: 0

Admins: 8

Forum Stats:

Groups: 1

Forums: 62

Topics: 2014

Posts: 8675

Newest Members:

Frankchets, jimchr, HerbertElaby, PhilipHar, Frankskync, FrankVag, LloydChelp, Vladcubre, BobbyFUT, Rickypaity

Administrators: admin: 23, Adrian Gosbell: 276, diseli: 810, Bob Maier: 3, Nico Peereboom: 60, Michael Rabone: 4, richiet: 406, JanCees: 28