Laravel: generated SQL error generates only specific tables

I access MS SQLServer through Laravel using Eloquent ORM or Query Builder. This works fine in all tables, but one particular table raises this error:

production.ERROR: exception 'Illuminate\Database\QueryException' 
with message 'SQLSTATE [HY000]: General error: 4004 General SQL Server error: 
Check messages from the SQL Server [4004] (severity 16) [(null)] 
(SQL: select * from [tblLeistung])

I executed this SQL query in MS SQLServer Management Studio, and it works fine. I also tried adding the database name and name to the ORM protected $table = 'DBName.dbo.tblLeistung';, which generates correctly (SQL: select * from [DBName].[dbo].[tblLeistung]), but also causes the same error.

The problem seems to be related to the schema, as it is a rather large table (23 columns, 2160 records). To drop it and recreate it using the same circuit still causes an error. Deleting it and creating a simple table with the same name solves the error (however, I need to make it work with this scheme).
Does anyone know if there are specific table designs that are not supported by SQLServer remote access through Laravel?
Are there other (simple) ways to check if the problem is with Laravel or with the server?

I have been in this for some time and appreciate any help. Thanks in advance!

The generated CREATE TABLEproblem table statement is as follows:

CREATE TABLE [dbo].[tblLeistung](
    [LeistungID] [int] IDENTITY(1,1) NOT NULL,
    [LeistungskatalogID] [int] NULL,
    [SchlagID] [int] NOT NULL,
    [StatusInternID] [int] NULL,
    [StatusExternID] [int] NULL,
    [VertragID] [int] NULL,
    [Menge] [float] NULL DEFAULT ((0)),
    [SperreLeistung] [bit] NULL DEFAULT ((0)),
    [SperreAusfuehrung] [bit] NULL DEFAULT ((0)),
    [RechnungEinkID] [int] NULL,
    [RechnungVerkID] [int] NULL,
    [LeistungsunterkatID] [int] NULL,
    [LeistungsBeschreibung] [nvarchar](max) NULL,
    [InterneNotiz] [nvarchar](max) NULL,
    [AbrechungsdatenVorhanden] [bit] NULL DEFAULT ((0)),
    [AuftragID] [smallint] NULL,
    [UeberleistungID] [int] NULL,
    [AuftraggeberID] [int] NULL,
    [SSMA_TimeStamp] [timestamp] NOT NULL,
    [DatumFrist] [datetime] NULL,
    [DatumGeplant] [datetime] NULL,
    [DatumAusgefuehrt] [datetime] NULL,
    [DatumAuftragfreigabe] [datetime] NULL,
 CONSTRAINT [tblLeistung$PrimaryKey] PRIMARY KEY CLUSTERED 
(
    [LeistungID] 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]

ALTER TABLE [dbo].[tblLeistung]  WITH NOCHECK ADD  CONSTRAINT [tblLeistung$tbRechnungVerktblLeistung] FOREIGN KEY([RechnungVerkID])
REFERENCES [dbo].[tblRechnungVerk] ([RechnungVerkID])
ON UPDATE CASCADE

ALTER TABLE [dbo].[tblLeistung] CHECK CONSTRAINT [tblLeistung$tbRechnungVerktblLeistung]

edit:

  • removal FOREIGN KEYdid not solve it
  • , , . DB , .
+3
2

:

$handle = getHandle();
    $handle->exec('SET QUOTED_IDENTIFIER ON');
     $handle->exec('SET ANSI_WARNINGS ON');
     $handle->exec('SET ANSI_PADDING ON');
     $handle->exec('SET ANSI_NULLS ON');
     $handle->exec('SET CONCAT_NULL_YIELDS_NULL ON');

: "/etc/freetds.conf" tds charset , php.ini mssql.charset default_charset

/etc/freetds.conf:

;tds version = 4.2
tds version = 8.0
client charset = UTF-8

php.ini:

mssql.charset = "UTF-8"
default_charset = "utf-8"

.

0

All Articles