Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLSTATE[HY000]: [Microsoft][ODBC Driver 18 for SQL Server]Unicode conversion failed #1479

Open
ngochangngo52 opened this issue Sep 16, 2023 · 14 comments

Comments

@ngochangngo52
Copy link

ngochangngo52 commented Sep 16, 2023

PHP version
8.1.23

PHP SQLSRV or PDO_SQLSRV version
php-sqlsrv-5.11.1-1.el9.remi.8.1.x86_64

Microsoft ODBC Driver version
[ODBC Driver 18 for SQL Server]

SQL Server version

Microsoft SQL Server 2016

Client operating system
Alma Linux 9.2 (WSL)

Table schema

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OCRD](
	[CardCode] [nvarchar](15) NOT NULL,
	[CardName] [nvarchar](100) NULL,
	[CardType] [char](1) NULL,
	[GroupCode] [smallint] NULL,
	[CmpPrivate] [char](1) NULL,
	[Address] [nvarchar](100) NULL,
	[ZipCode] [nvarchar](20) NULL,
	[MailAddres] [nvarchar](100) NULL,
	[MailZipCod] [nvarchar](20) NULL,
	[Phone1] [nvarchar](20) NULL,
	[Phone2] [nvarchar](20) NULL,
	[Fax] [nvarchar](20) NULL,
	[CntctPrsn] [nvarchar](90) NULL,
	[Notes] [nvarchar](100) NULL,
	[Balance] [numeric](19, 6) NULL,
	[ChecksBal] [numeric](19, 6) NULL,
	[DNotesBal] [numeric](19, 6) NULL,
	[OrdersBal] [numeric](19, 6) NULL,
	[GroupNum] [smallint] NULL,
	[CreditLine] [numeric](19, 6) NULL,
	[DebtLine] [numeric](19, 6) NULL,
	[Discount] [numeric](19, 6) NULL,
	[VatStatus] [char](1) NULL,
	[LicTradNum] [nvarchar](32) NULL,
	[DdctStatus] [char](1) NULL,
	[DdctPrcnt] [numeric](19, 6) NULL,
	[ValidUntil] [datetime] NULL,
	[Chrctrstcs] [int] NULL,
	[ExMatchNum] [int] NULL,
	[InMatchNum] [int] NULL,
	[ListNum] [smallint] NULL,
	[DNoteBalFC] [numeric](19, 6) NULL,
	[OrderBalFC] [numeric](19, 6) NULL,
	[DNoteBalSy] [numeric](19, 6) NULL,
	[OrderBalSy] [numeric](19, 6) NULL,
	[Transfered] [char](1) NULL,
	[BalTrnsfrd] [char](1) NULL,
	[IntrstRate] [numeric](19, 6) NULL,
	[Commission] [numeric](19, 6) NULL,
	[CommGrCode] [smallint] NULL,
	[Free_Text] [ntext] NULL,
	[SlpCode] [int] NULL,
	[PrevYearAc] [char](1) NULL,
	[Currency] [nvarchar](3) NULL,
	[RateDifAct] [nvarchar](15) NULL,
	[BalanceSys] [numeric](19, 6) NULL,
	[BalanceFC] [numeric](19, 6) NULL,
	[Protected] [char](1) NULL,
	[Cellular] [nvarchar](50) NULL,
	[AvrageLate] [smallint] NULL,
	[City] [nvarchar](100) NULL,
	[County] [nvarchar](100) NULL,
	[Country] [nvarchar](3) NULL,
	[MailCity] [nvarchar](100) NULL,
	[MailCounty] [nvarchar](100) NULL,
	[MailCountr] [nvarchar](3) NULL,
	[E_Mail] [nvarchar](100) NULL,
	[Picture] [nvarchar](200) NULL,
	[DflAccount] [nvarchar](50) NULL,
	[DflBranch] [nvarchar](50) NULL,
	[BankCode] [nvarchar](30) NULL,
	[AddID] [nvarchar](64) NULL,
	[Pager] [nvarchar](30) NULL,
	[FatherCard] [nvarchar](15) NULL,
	[CardFName] [nvarchar](100) NULL,
	[FatherType] [char](1) NULL,
	[QryGroup1] [char](1) NULL,
	[QryGroup2] [char](1) NULL,
	[QryGroup3] [char](1) NULL,
	[QryGroup4] [char](1) NULL,
	[QryGroup5] [char](1) NULL,
	[QryGroup6] [char](1) NULL,
	[QryGroup7] [char](1) NULL,
	[QryGroup8] [char](1) NULL,
	[QryGroup9] [char](1) NULL,
	[QryGroup10] [char](1) NULL,
	[QryGroup11] [char](1) NULL,
	[QryGroup12] [char](1) NULL,
	[QryGroup13] [char](1) NULL,
	[QryGroup14] [char](1) NULL,
	[QryGroup15] [char](1) NULL,
	[QryGroup16] [char](1) NULL,
	[QryGroup17] [char](1) NULL,
	[QryGroup18] [char](1) NULL,
	[QryGroup19] [char](1) NULL,
	[QryGroup20] [char](1) NULL,
	[QryGroup21] [char](1) NULL,
	[QryGroup22] [char](1) NULL,
	[QryGroup23] [char](1) NULL,
	[QryGroup24] [char](1) NULL,
	[QryGroup25] [char](1) NULL,
	[QryGroup26] [char](1) NULL,
	[QryGroup27] [char](1) NULL,
	[QryGroup28] [char](1) NULL,
	[QryGroup29] [char](1) NULL,
	[QryGroup30] [char](1) NULL,
	[QryGroup31] [char](1) NULL,
	[QryGroup32] [char](1) NULL,
	[QryGroup33] [char](1) NULL,
	[QryGroup34] [char](1) NULL,
	[QryGroup35] [char](1) NULL,
	[QryGroup36] [char](1) NULL,
	[QryGroup37] [char](1) NULL,
	[QryGroup38] [char](1) NULL,
	[QryGroup39] [char](1) NULL,
	[QryGroup40] [char](1) NULL,
	[QryGroup41] [char](1) NULL,
	[QryGroup42] [char](1) NULL,
	[QryGroup43] [char](1) NULL,
	[QryGroup44] [char](1) NULL,
	[QryGroup45] [char](1) NULL,
	[QryGroup46] [char](1) NULL,
	[QryGroup47] [char](1) NULL,
	[QryGroup48] [char](1) NULL,
	[QryGroup49] [char](1) NULL,
	[QryGroup50] [char](1) NULL,
	[QryGroup51] [char](1) NULL,
	[QryGroup52] [char](1) NULL,
	[QryGroup53] [char](1) NULL,
	[QryGroup54] [char](1) NULL,
	[QryGroup55] [char](1) NULL,
	[QryGroup56] [char](1) NULL,
	[QryGroup57] [char](1) NULL,
	[QryGroup58] [char](1) NULL,
	[QryGroup59] [char](1) NULL,
	[QryGroup60] [char](1) NULL,
	[QryGroup61] [char](1) NULL,
	[QryGroup62] [char](1) NULL,
	[QryGroup63] [char](1) NULL,
	[QryGroup64] [char](1) NULL,
	[DdctOffice] [nvarchar](10) NULL,
	[CreateDate] [datetime] NULL,
	[UpdateDate] [datetime] NULL,
	[ExportCode] [nvarchar](8) NULL,
	[DscntObjct] [smallint] NULL,
	[DscntRel] [char](1) NULL,
	[SPGCounter] [smallint] NULL,
	[SPPCounter] [int] NULL,
	[DdctFileNo] [nvarchar](9) NULL,
	[SCNCounter] [smallint] NULL,
	[MinIntrst] [numeric](19, 6) NULL,
	[DataSource] [char](1) NULL,
	[OprCount] [int] NULL,
	[ExemptNo] [nvarchar](50) NULL,
	[Priority] [int] NULL,
	[CreditCard] [smallint] NULL,
	[CrCardNum] [nvarchar](64) NULL,
	[CardValid] [datetime] NULL,
	[UserSign] [smallint] NULL,
	[LocMth] [char](1) NULL,
	[validFor] [char](1) NULL,
	[validFrom] [datetime] NULL,
	[validTo] [datetime] NULL,
	[frozenFor] [char](1) NULL,
	[frozenFrom] [datetime] NULL,
	[frozenTo] [datetime] NULL,
	[sEmployed] [char](1) NULL,
	[MTHCounter] [int] NULL,
	[BNKCounter] [int] NULL,
	[DdgKey] [int] NULL,
	[DdtKey] [int] NULL,
	[ValidComm] [nvarchar](30) NULL,
	[FrozenComm] [nvarchar](30) NULL,
	[chainStore] [char](1) NULL,
	[DiscInRet] [char](1) NULL,
	[State1] [nvarchar](3) NULL,
	[State2] [nvarchar](3) NULL,
	[VatGroup] [nvarchar](8) NULL,
	[LogInstanc] [int] NULL,
	[ObjType] [nvarchar](20) NULL,
	[Indicator] [nvarchar](2) NULL,
	[ShipType] [smallint] NULL,
	[DebPayAcct] [nvarchar](15) NULL,
	[ShipToDef] [nvarchar](50) NULL,
	[Block] [nvarchar](100) NULL,
	[MailBlock] [nvarchar](100) NULL,
	[Password] [nvarchar](32) NULL,
	[ECVatGroup] [nvarchar](8) NULL,
	[Deleted] [char](1) NULL,
	[IBAN] [nvarchar](50) NULL,
	[DocEntry] [int] NOT NULL,
	[FormCode] [int] NULL,
	[Box1099] [nvarchar](20) NULL,
	[PymCode] [nvarchar](15) NULL,
	[BackOrder] [char](1) NULL,
	[PartDelivr] [char](1) NULL,
	[DunnLevel] [int] NULL,
	[DunnDate] [datetime] NULL,
	[BlockDunn] [char](1) NULL,
	[BankCountr] [nvarchar](3) NULL,
	[CollecAuth] [char](1) NULL,
	[DME] [nvarchar](5) NULL,
	[InstrucKey] [nvarchar](30) NULL,
	[SinglePaym] [char](1) NULL,
	[ISRBillId] [nvarchar](9) NULL,
	[PaymBlock] [char](1) NULL,
	[RefDetails] [nvarchar](20) NULL,
	[HouseBank] [nvarchar](30) NULL,
	[OwnerIdNum] [nvarchar](15) NULL,
	[PyBlckDesc] [int] NULL,
	[HousBnkCry] [nvarchar](3) NULL,
	[HousBnkAct] [nvarchar](50) NULL,
	[HousBnkBrn] [nvarchar](50) NULL,
	[ProjectCod] [nvarchar](20) NULL,
	[SysMatchNo] [int] NULL,
	[VatIdUnCmp] [nvarchar](32) NULL,
	[AgentCode] [nvarchar](32) NULL,
	[TolrncDays] [smallint] NULL,
	[SelfInvoic] [char](1) NULL,
	[DeferrTax] [char](1) NULL,
	[LetterNum] [nvarchar](20) NULL,
	[MaxAmount] [numeric](19, 6) NULL,
	[FromDate] [datetime] NULL,
	[ToDate] [datetime] NULL,
	[WTLiable] [char](1) NULL,
	[CrtfcateNO] [nvarchar](20) NULL,
	[ExpireDate] [datetime] NULL,
	[NINum] [nvarchar](20) NULL,
	[AccCritria] [char](1) NULL,
	[WTCode] [nvarchar](4) NULL,
	[Equ] [char](1) NULL,
	[HldCode] [nvarchar](20) NULL,
	[ConnBP] [nvarchar](15) NULL,
	[MltMthNum] [int] NULL,
	[TypWTReprt] [char](1) NULL,
	[VATRegNum] [nvarchar](32) NULL,
	[RepName] [nvarchar](15) NULL,
	[Industry] [ntext] NULL,
	[Business] [ntext] NULL,
	[WTTaxCat] [ntext] NULL,
	[IsDomestic] [char](1) NULL,
	[IsResident] [char](1) NULL,
	[AutoCalBCG] [char](1) NULL,
	[OtrCtlAcct] [nvarchar](15) NULL,
	[AliasName] [ntext] NULL,
	[Building] [ntext] NULL,
	[MailBuildi] [ntext] NULL,
	[BoEPrsnt] [nvarchar](15) NULL,
	[BoEDiscnt] [nvarchar](15) NULL,
	[BoEOnClct] [nvarchar](15) NULL,
	[UnpaidBoE] [nvarchar](15) NULL,
	[ITWTCode] [nvarchar](4) NULL,
	[DunTerm] [nvarchar](25) NULL,
	[ChannlBP] [nvarchar](15) NULL,
	[DfTcnician] [int] NULL,
	[Territory] [int] NULL,
	[BillToDef] [nvarchar](50) NULL,
	[DpmClear] [nvarchar](15) NULL,
	[IntrntSite] [nvarchar](100) NULL,
	[LangCode] [int] NULL,
	[HousActKey] [int] NULL,
	[Profession] [nvarchar](50) NULL,
	[CDPNum] [smallint] NULL,
	[DflBankKey] [int] NULL,
	[BCACode] [nvarchar](3) NULL,
	[UseShpdGd] [char](1) NULL,
	[RegNum] [nvarchar](32) NULL,
	[VerifNum] [nvarchar](32) NULL,
	[BankCtlKey] [nvarchar](2) NULL,
	[HousCtlKey] [nvarchar](2) NULL,
	[AddrType] [nvarchar](100) NULL,
	[InsurOp347] [char](1) NULL,
	[MailAddrTy] [nvarchar](100) NULL,
	[StreetNo] [nvarchar](100) NULL,
	[MailStrNo] [nvarchar](100) NULL,
	[TaxRndRule] [char](1) NULL,
	[VendTID] [int] NULL,
	[ThreshOver] [char](1) NULL,
	[SurOver] [char](1) NULL,
	[VendorOcup] [nvarchar](15) NULL,
	[OpCode347] [char](1) NULL,
	[DpmIntAct] [nvarchar](15) NULL,
	[ResidenNum] [char](1) NULL,
	[UserSign2] [smallint] NULL,
	[PlngGroup] [nvarchar](10) NULL,
	[VatIDNum] [nvarchar](32) NULL,
	[Affiliate] [char](1) NULL,
	[MivzExpSts] [char](1) NULL,
	[HierchDdct] [char](1) NULL,
	[CertWHT] [char](1) NULL,
	[CertBKeep] [char](1) NULL,
	[WHShaamGrp] [char](1) NULL,
	[IndustryC] [int] NULL,
	[DatevAcct] [int] NULL,
	[DatevFirst] [char](1) NULL,
	[GTSRegNum] [nvarchar](20) NULL,
	[GTSBankAct] [nvarchar](80) NULL,
	[GTSBilAddr] [nvarchar](80) NULL,
	[HsBnkSwift] [nvarchar](50) NULL,
	[HsBnkIBAN] [nvarchar](50) NULL,
	[DflSwift] [nvarchar](50) NULL,
	[AutoPost] [char](1) NULL,
	[IntrAcc] [nvarchar](15) NULL,
	[FeeAcc] [nvarchar](15) NULL,
	[CpnNo] [int] NULL,
	[NTSWebSite] [smallint] NULL,
	[DflIBAN] [nvarchar](50) NULL,
	[Series] [smallint] NULL,
	[Number] [int] NULL,
	[EDocExpFrm] [int] NULL,
	[TaxIdIdent] [char](1) NULL,
	[Attachment] [ntext] NULL,
	[AtcEntry] [int] NULL,
	[DiscRel] [char](1) NULL,
	[NoDiscount] [char](1) NULL,
	[SCAdjust] [char](1) NULL,
	[DflAgrmnt] [int] NULL,
	[GlblLocNum] [nvarchar](50) NULL,
	[SenderID] [nvarchar](50) NULL,
	[RcpntID] [nvarchar](50) NULL,
	[MainUsage] [int] NULL,
	[SefazCheck] [char](1) NULL,
	[free312] [char](1) NULL,
	[free313] [char](1) NULL,
	[DateFrom] [datetime] NULL,
	[DateTill] [datetime] NULL,
	[RelCode] [nvarchar](2) NULL,
	[OKATO] [nvarchar](11) NULL,
	[OKTMO] [nvarchar](12) NULL,
	[KBKCode] [nvarchar](20) NULL,
	[TypeOfOp] [char](1) NULL,
	[OwnerCode] [int] NULL,
	[MandateID] [nvarchar](35) NULL,
	[SignDate] [datetime] NULL,
	[Remark1] [int] NULL,
	[ConCerti] [nvarchar](20) NULL,
	[TpCusPres] [int] NULL,
	[RoleTypCod] [nvarchar](2) NULL,
	[BlockComm] [char](1) NULL,
	[EmplymntCt] [nvarchar](2) NULL,
	[ExcptnlEvt] [char](1) NULL,
	[ExpnPrfFnd] [numeric](19, 6) NULL,
	[EdrsFromBP] [char](1) NULL,
	[EdrsToBP] [char](1) NULL,
	[CreateTS] [int] NULL,
	[UpdateTS] [int] NULL,
	[EDocGenTyp] [char](1) NULL,
	[eStreet] [nvarchar](38) NULL,
	[eStreetNum] [nvarchar](4) NULL,
	[eBuildnNum] [int] NULL,
	[eZipCode] [nvarchar](10) NULL,
	[eCityTown] [nvarchar](48) NULL,
	[eCountry] [nvarchar](3) NULL,
	[eDistrict] [nvarchar](3) NULL,
	[RepFName] [nvarchar](20) NULL,
	[RepSName] [nvarchar](36) NULL,
	[RepCmpName] [nvarchar](36) NULL,
	[RepFisCode] [nvarchar](16) NULL,
	[RepAddID] [nvarchar](28) NULL,
	[PECAddr] [nvarchar](254) NULL,
	[IPACodePA] [nvarchar](32) NULL,
	[MerchantID] [nvarchar](15) NULL,
	[U_PBPCode] [nvarchar](15) NULL,
	[U_RequestedBy] [nvarchar](30) NULL,
	[U_Branch] [nvarchar](5) NULL,
	[U_BROWNER] [nvarchar](10) NULL,
	[U_ExpType] [nvarchar](254) NULL,
 CONSTRAINT [OCRD_PRIMARY] PRIMARY KEY CLUSTERED 
(
	[CardCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [OCRD_ABS_ENTRY] ON [dbo].[OCRD]
(
	[DocEntry] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
CREATE NONCLUSTERED INDEX [OCRD_CARD_NAME] ON [dbo].[OCRD]
(
	[CardName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
CREATE NONCLUSTERED INDEX [OCRD_CARD_TYPE] ON [dbo].[OCRD]
(
	[CardType] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [OCRD_COM_GROUP] ON [dbo].[OCRD]
(
	[CommGrCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
CREATE NONCLUSTERED INDEX [OCRD_CURRENCY] ON [dbo].[OCRD]
(
	[Currency] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
CREATE NONCLUSTERED INDEX [OCRD_FATHER] ON [dbo].[OCRD]
(
	[FatherCard] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [OCRD_OWNER_CODE] ON [dbo].[OCRD]
(
	[OwnerCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
CREATE NONCLUSTERED INDEX [OCRD_PAY_ACCT] ON [dbo].[OCRD]
(
	[DebPayAcct] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [OCRD_PRICE_LIST] ON [dbo].[OCRD]
(
	[ListNum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [OCRD_TERMS] ON [dbo].[OCRD]
(
	[GroupNum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_CardType]  DEFAULT ('C') FOR [CardType]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_CmpPrivate]  DEFAULT ('C') FOR [CmpPrivate]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_GroupNum]  DEFAULT ((-1)) FOR [GroupNum]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_VatStatus]  DEFAULT ('Y') FOR [VatStatus]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_DdctStatus]  DEFAULT ('N') FOR [DdctStatus]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_Transfered]  DEFAULT ('N') FOR [Transfered]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_BalTrnsfrd]  DEFAULT ('N') FOR [BalTrnsfrd]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_CommGrCode]  DEFAULT ((0)) FOR [CommGrCode]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_SlpCode]  DEFAULT ((-1)) FOR [SlpCode]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_PrevYearAc]  DEFAULT ('N') FOR [PrevYearAc]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_Protected]  DEFAULT ('N') FOR [Protected]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_BankCode]  DEFAULT ('-1') FOR [BankCode]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_FatherType]  DEFAULT ('P') FOR [FatherType]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup1]  DEFAULT ('N') FOR [QryGroup1]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup2]  DEFAULT ('N') FOR [QryGroup2]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup3]  DEFAULT ('N') FOR [QryGroup3]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup4]  DEFAULT ('N') FOR [QryGroup4]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup5]  DEFAULT ('N') FOR [QryGroup5]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup6]  DEFAULT ('N') FOR [QryGroup6]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup7]  DEFAULT ('N') FOR [QryGroup7]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup8]  DEFAULT ('N') FOR [QryGroup8]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup9]  DEFAULT ('N') FOR [QryGroup9]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup10]  DEFAULT ('N') FOR [QryGroup10]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup11]  DEFAULT ('N') FOR [QryGroup11]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup12]  DEFAULT ('N') FOR [QryGroup12]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup13]  DEFAULT ('N') FOR [QryGroup13]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup14]  DEFAULT ('N') FOR [QryGroup14]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup15]  DEFAULT ('N') FOR [QryGroup15]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup16]  DEFAULT ('N') FOR [QryGroup16]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup17]  DEFAULT ('N') FOR [QryGroup17]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup18]  DEFAULT ('N') FOR [QryGroup18]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup19]  DEFAULT ('N') FOR [QryGroup19]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup20]  DEFAULT ('N') FOR [QryGroup20]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup21]  DEFAULT ('N') FOR [QryGroup21]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup22]  DEFAULT ('N') FOR [QryGroup22]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup23]  DEFAULT ('N') FOR [QryGroup23]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup24]  DEFAULT ('N') FOR [QryGroup24]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup25]  DEFAULT ('N') FOR [QryGroup25]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup26]  DEFAULT ('N') FOR [QryGroup26]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup27]  DEFAULT ('N') FOR [QryGroup27]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup28]  DEFAULT ('N') FOR [QryGroup28]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup29]  DEFAULT ('N') FOR [QryGroup29]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup30]  DEFAULT ('N') FOR [QryGroup30]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup31]  DEFAULT ('N') FOR [QryGroup31]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup32]  DEFAULT ('N') FOR [QryGroup32]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup33]  DEFAULT ('N') FOR [QryGroup33]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup34]  DEFAULT ('N') FOR [QryGroup34]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup35]  DEFAULT ('N') FOR [QryGroup35]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup36]  DEFAULT ('N') FOR [QryGroup36]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup37]  DEFAULT ('N') FOR [QryGroup37]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup38]  DEFAULT ('N') FOR [QryGroup38]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup39]  DEFAULT ('N') FOR [QryGroup39]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup40]  DEFAULT ('N') FOR [QryGroup40]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup41]  DEFAULT ('N') FOR [QryGroup41]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup42]  DEFAULT ('N') FOR [QryGroup42]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup43]  DEFAULT ('N') FOR [QryGroup43]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup44]  DEFAULT ('N') FOR [QryGroup44]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup45]  DEFAULT ('N') FOR [QryGroup45]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup46]  DEFAULT ('N') FOR [QryGroup46]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup47]  DEFAULT ('N') FOR [QryGroup47]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup48]  DEFAULT ('N') FOR [QryGroup48]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup49]  DEFAULT ('N') FOR [QryGroup49]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup50]  DEFAULT ('N') FOR [QryGroup50]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup51]  DEFAULT ('N') FOR [QryGroup51]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup52]  DEFAULT ('N') FOR [QryGroup52]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup53]  DEFAULT ('N') FOR [QryGroup53]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup54]  DEFAULT ('N') FOR [QryGroup54]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup55]  DEFAULT ('N') FOR [QryGroup55]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup56]  DEFAULT ('N') FOR [QryGroup56]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup57]  DEFAULT ('N') FOR [QryGroup57]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup58]  DEFAULT ('N') FOR [QryGroup58]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup59]  DEFAULT ('N') FOR [QryGroup59]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup60]  DEFAULT ('N') FOR [QryGroup60]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup61]  DEFAULT ('N') FOR [QryGroup61]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup62]  DEFAULT ('N') FOR [QryGroup62]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup63]  DEFAULT ('N') FOR [QryGroup63]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_QryGroup64]  DEFAULT ('N') FOR [QryGroup64]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_DscntObjct]  DEFAULT ((-1)) FOR [DscntObjct]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_DscntRel]  DEFAULT ('L') FOR [DscntRel]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_SPGCounter]  DEFAULT ((0)) FOR [SPGCounter]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_SPPCounter]  DEFAULT ((0)) FOR [SPPCounter]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_DataSource]  DEFAULT ('N') FOR [DataSource]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_Priority]  DEFAULT ((-1)) FOR [Priority]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_CreditCard]  DEFAULT ((-1)) FOR [CreditCard]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_LocMth]  DEFAULT ('Y') FOR [LocMth]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_validFor]  DEFAULT ('N') FOR [validFor]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_frozenFor]  DEFAULT ('N') FOR [frozenFor]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_sEmployed]  DEFAULT ('N') FOR [sEmployed]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_DdgKey]  DEFAULT ((-1)) FOR [DdgKey]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_DdtKey]  DEFAULT ((-1)) FOR [DdtKey]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_chainStore]  DEFAULT ('N') FOR [chainStore]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_DiscInRet]  DEFAULT ('N') FOR [DiscInRet]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_LogInstanc]  DEFAULT ((0)) FOR [LogInstanc]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_ObjType]  DEFAULT ('2') FOR [ObjType]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_Deleted]  DEFAULT ('N') FOR [Deleted]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_PymCode]  DEFAULT ('-1') FOR [PymCode]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_BackOrder]  DEFAULT ('Y') FOR [BackOrder]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_PartDelivr]  DEFAULT ('Y') FOR [PartDelivr]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_BlockDunn]  DEFAULT ('N') FOR [BlockDunn]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_CollecAuth]  DEFAULT ('N') FOR [CollecAuth]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_SinglePaym]  DEFAULT ('N') FOR [SinglePaym]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_PaymBlock]  DEFAULT ('N') FOR [PaymBlock]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_HouseBank]  DEFAULT ('-1') FOR [HouseBank]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_PyBlckDesc]  DEFAULT ((-1)) FOR [PyBlckDesc]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_SysMatchNo]  DEFAULT ((-1)) FOR [SysMatchNo]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_AccCritria]  DEFAULT ('N') FOR [AccCritria]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_Equ]  DEFAULT ('N') FOR [Equ]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_TypWTReprt]  DEFAULT ('C') FOR [TypWTReprt]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_IsDomestic]  DEFAULT ('Y') FOR [IsDomestic]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_IsResident]  DEFAULT ('Y') FOR [IsResident]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_AutoCalBCG]  DEFAULT ('N') FOR [AutoCalBCG]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_UseShpdGd]  DEFAULT ('Y') FOR [UseShpdGd]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_InsurOp347]  DEFAULT ('N') FOR [InsurOp347]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_TaxRndRule]  DEFAULT ('D') FOR [TaxRndRule]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_ThreshOver]  DEFAULT ('N') FOR [ThreshOver]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_SurOver]  DEFAULT ('N') FOR [SurOver]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_OpCode347]  DEFAULT ('A') FOR [OpCode347]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_ResidenNum]  DEFAULT ('1') FOR [ResidenNum]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_Affiliate]  DEFAULT ('N') FOR [Affiliate]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_MivzExpSts]  DEFAULT ('B') FOR [MivzExpSts]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_HierchDdct]  DEFAULT ('Y') FOR [HierchDdct]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_CertWHT]  DEFAULT ('N') FOR [CertWHT]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_CertBKeep]  DEFAULT ('N') FOR [CertBKeep]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_WHShaamGrp]  DEFAULT ('1') FOR [WHShaamGrp]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_DatevFirst]  DEFAULT ('Y') FOR [DatevFirst]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_AutoPost]  DEFAULT ('N') FOR [AutoPost]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_TaxIdIdent]  DEFAULT ('3') FOR [TaxIdIdent]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_DiscRel]  DEFAULT ('L') FOR [DiscRel]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_NoDiscount]  DEFAULT ('N') FOR [NoDiscount]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_SCAdjust]  DEFAULT ('N') FOR [SCAdjust]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_SefazCheck]  DEFAULT ('N') FOR [SefazCheck]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_TpCusPres]  DEFAULT ((9)) FOR [TpCusPres]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_BlockComm]  DEFAULT ('N') FOR [BlockComm]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_EdrsFromBP]  DEFAULT ('Y') FOR [EdrsFromBP]
GO
ALTER TABLE [dbo].[OCRD] ADD  CONSTRAINT [DF_OCRD_EdrsToBP]  DEFAULT ('N') FOR [EdrsToBP]
GO

Collate SQL_Latin1_General_CP1_CI_AS

Problem description
I run simple query in my app (connect via php-sqlsrv) select top 1 [CardType] from [dbo].[OCRD] where [CardCode] = 'MyClientCode' and it raised error:

SQLSTATE[HY000]: [Microsoft][ODBC Driver 18 for SQL Server]Unicode conversion failed

I run in sqlcmd, it will have error:
Sqlcmd: Error: Internal error at ReadAndHandleColumnData (Reason: Error reading column data). Unicode conversion failed

Expected behavior and actual behavior
Expected result: 'C'
Actual Result: Unicode conversion failed

Run in Laravel via sqlsrv extension
image

Run directly in sqlcmd utility
image

Expected result (run in Azure Data Studio, on Windows, it works)
image

Repro code or steps to reproduce
Just run select top 1 [CardType] from [dbo].[OCRD] where [CardCode] = 'MyClientCode' in your app connect via sqlsrv or in sqlcmd utility, it will throw error

@v-makouz
Copy link
Contributor

What does the server give when running select @@version? I tried to reproduce this, but the table query gives errors on every SQL server I tried.

@ngochangngo52
Copy link
Author

select @@Version

Microsoft SQL Server 2016 (SP3-GDR) (KB5021129) - 13.0.6430.49 (X64) 
Jan 22 2023 17:38:22 
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 <X64> (Build 9600: )

@v-makouz
Copy link
Contributor

I can't seem to reproduce this one. I can execute the select query just fine with no errors. Also the table create query appears to be incorrect, the default values and NULL settings have to come after COLLATE, did it actually work as is?

@ngochangngo52
Copy link
Author

I can't seem to reproduce this one. I can execute the select query just fine with no errors. Also the table create query appears to be incorrect, the default values and NULL settings have to come after COLLATE, did it actually work as is?

It's OCRD table for SAP B1 database, you can find it here https://sap.erpref.com/?schema=BusinessOne9.3&module_id=3&table=OCRD
My app connected to existing SAP B1 database, I don't create new one.
Above creation SQL is just my extraction of structure using Heidi SQL so that can let you know the structure, I don't know the statement is weird to SQL Server :) It's sort of "reverse" from existing database, using Heidi SQL as tool.

The query can run in HeidiSQL, MS Azure Data Studio... but if I run in SqlCmd in the environment above, the error will throw.

@ngochangngo52
Copy link
Author

Also the table create query appears to be incorrect, the default values and NULL settings have to come after COLLATE, did it actually work as is?

I just updated the table creation, generate from MS Azure Data Studio should be correct one.

@ngochangngo52
Copy link
Author

ngochangngo52 commented Sep 20, 2023

Run in Laravel via sqlsrv extension
image

Run directly in sqlcmd utility
image

Expected result (run in Azure Data Studio, on Windows, it works)
image

@ngochangngo52
Copy link
Author

ngochangngo52 commented Sep 20, 2023

If I run sqlcmd utility on Windows it will also work
image

The error is only happened with the sqlcmd on Linux (Alma 9.2) as above

@ngochangngo52
Copy link
Author

Just found this https://stackoverflow.com/a/77140830/223934
Basically installing glibc-gconv-extra solve my problem.
sudo dnf install glibc-gconv-extra

But the problem doesn't exist if I don't update. Do you have any idea?

@v-makouz
Copy link
Contributor

Probably that type of conversion isn't available by default on Alma Linux, I'm not sure since that's not an officially supported OS.

@ngochangngo52
Copy link
Author

ngochangngo52 commented Sep 22, 2023

Probably that type of conversion isn't available by default on Alma Linux, I'm not sure since that's not an officially supported OS.

Not only Alma Linux, but the entire Fedora family (including RHEL, Oracle Linux, Centos). For some distros, glibc already includes gconv, but for Fedora family, the gconv has been splitted in to a separate package glibc-gconv-extra
https://fedoraproject.org/wiki/Changes/Gconv_package_split_in_glibc

I think the ODBC should verify the dependency when installing.

@mtovmassian
Copy link

If installing glibc-gconv-extra on Red Hat x glibc systems solve the problem, does a solution exist on Alpine Linux x musl systems?

@v-maximko
Copy link

I don't believe that package is available on Alpine, but what encodings are you looking for?

@mtovmassian
Copy link

My question is related to this stackoverflow question where the error could be a lack of enconding support for Japanese.

@v-makouz
Copy link
Contributor

Alpine's iconv does not have encodings for Japanese (among others). There is a gnu-libiconv package that contains a lot of the missing code pages, including Japanese ones. I've never used it myself, but apparently this is how you do it:
apk add --no-cache gnu-libiconv to install
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so before running the app

Here's the page for it, with more info: https://www.gnu.org/software/libiconv/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants