Reputation: 44448
This question results from advice I received in this one, namely the changing of my error code definition and going from there.
My problem: when trying to insert data into a table, I receive SQLCODE 00195
and SQLSTATE S0001
. If I understand error codes correctly, a positive non-zero number means the query succeeded but with warnings. When I look at my database, no data has been inserted.
I've found two resources which describe this error code as
is not a recognized built-in function name
As you'll see, the two functions used in my expression are TRIM
and SHA1
. If I omit both of them, the same error persists.
Using the PIC -(4)9
definition of the SQLCODE field, as suggested in my other post, returns -195
as result, also an error code I can't seem to find anything about.
I use SQL Server 2012 and Percobol, which utilizes the OpenCobol compiler.
Declaration of fields:
01 SQLCODE PIC 9(5).
01 SQLSTATE PIC X(5).
01 WS-INPUT.
05 ACHTERNAAM PIC X(25) VALUE SPACES.
05 VOORNAAM PIC X(15) VALUE SPACES.
05 EMAIL PIC X(50) VALUE SPACES.
05 LOGIN PIC X(15) VALUE SPACES.
05 WACHTWOORD PIC X(11) VALUE SPACES.
05 GEBR_TYPE PIC X(20) VALUE SPACES.
SQL Query:
EXEC SQL INSERT INTO dbo.Gebruikers
VALUES ( TRIM( :LOGIN ), TRIM( :ACHTERNAAM ),
TRIM( :EMAIL ), TRIM( :PROJECTCODE ),
TRIM( :GEBR_TYPE ), TRIM( :VOORNAAM ),
SHA1( TRIM( :WACHTWOORD ) ) )
END-EXEC
Database:
Connection string:
jdbc:sqlserver://localhost\SQLEXPRESS;databaseName=Groep31;user=Groep31;password=somepw
Upvotes: 1
Views: 2286
Reputation: 44448
Solution: TRIM
isn't supported in SQL Server. Using RTRIM
fixed it.
Solution: SHA1
isn't supported either in SQL Server. Using HashBytes('SHA1', RTRIM(:WACHTWOORD))
fixed this (although there are some encoding issues right now).
Upvotes: 2