-
Richard Hartman
- PowerBuilder
- Friday, 21 February 2025 12:35 AM UTC
environment: powerbuilder 2021
we are migrating the database from sybase to ms sql server
The function is of_createkey().
It iterates through the data fields of an object, looking to see which, if any, are key fields. It does this using the Describe() function. The key line in this function is this:
If ads_obj.Describe(ls_Obj[li_Cnt] + ".key") = "yes" Then
Where ls_Obj[li_cnt] is, in each case "name" (confirmed by debugger).
So ... with sybase, we find that the "name" field is a key. But with mssql server, we don't.
However both _are_ key fields. (The table defs are below.)
Why would this fail for ms sql server when it was working for sybase, and both have "name" configured as a key field?
-- sybase
CREATE TABLE dbo.SECURITY_USERS
(
NAME varchar(16) NOT NULL,
DESCRIPTION varchar(32) NOT NULL,
PRIORITY int NOT NULL,
USER_TYPE int NULL,
EXTERNAL_CUSTOMER char(1) NOT NULL,
LAST_MOD_USER char(8) NULL,
LAST_MOD_DATE datetime NULL,
OWNING_SITE_ID int NULL,
LAST_PASSWORD_MOD_USER char(8) NULL,
LAST_PASSWORD_MOD_DATE datetime NULL,
CONSTRAINT SECURITY_USERS_X
PRIMARY KEY NONCLUSTERED (NAME)
)
-- mssql
CREATE TABLE dbo.SECURITY_USERS
(
CUID varchar(16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
NAME varchar(16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
DESCRIPTION varchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
PRIORITY int NOT NULL,
USER_TYPE int NULL,
EXTERNAL_CUSTOMER char(1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
LAST_MOD_USER char(16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
LAST_MOD_DATE datetime2(3) NULL,
OWNING_SITE_ID int NULL,
LAST_PASSWORD_MOD_USER char(16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
LAST_PASSWORD_MOD_DATE datetime2(3) NULL,
CONSTRAINT PK_SECURITY_USERS
PRIMARY KEY NONCLUSTERED (NAME)
)
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.