Column types do not match in statement ошибка openoffice

wbgill

Posts: 4
Joined: Thu Sep 04, 2008 9:11 pm


[Solved] Column Types do not match?

I am new to base and I guess it shows! I am trying to create a simple database to help the non-profit Kiwanis club that I belong to track sales for a fund raiser, keep a customer list and create labels for sending out confirmations after they send their checks to us.
I am setting up the following tables: Customers, Members, Orders, Order Details and Products. I thought I was on the right course, but when trying to set up the relationships, I get the following message «Column types do not match in statement [ALTER TABLES «Orders» ADD FOREIGN KEY («Members») REFERENCES «Members» (MemberID»)].
I am frankly at a loss. I thought that perhaps it was referring to field type and I tried changing from numeric to integer for my «ID» numbers, but got a different error message when I tried to save it. Ended up having to delete the table and create it again.
I would appreciate some help if anyone has any ideas. I’m sure it’s something simple, but darned if I can see what I’m doing wrong.
Thank you!
Bill

Last edited by wbgill on Mon Jun 15, 2009 10:36 pm, edited 1 time in total.

OOo 2.2.X on Ms Windows XP

User avatar

r4zoli

Volunteer
Posts: 2882
Joined: Mon Nov 19, 2007 8:23 pm
Location: Budapest, Hungary

Re: Column Types do not match?

Post

by r4zoli » Sat Jun 13, 2009 12:42 pm

«Column types do not match in statement [ALTER TABLES «Orders» ADD FOREIGN KEY («Members») REFERENCES «Members» (MemberID»)

Two fields(colums) type must be same when you creating FK relationship.
«MemberID» in referenced table and «Memebers» in table where you want to connect the other table, must be the same type, for example both must be «Integer» type.

wbgill

Posts: 4
Joined: Thu Sep 04, 2008 9:11 pm


Re: Column Types do not match?

Post

by wbgill » Mon Jun 15, 2009 10:35 pm

Thanks for your response!
I thought that might have been the problem. I did change to integers on all of the ID fields. Think I had numeric to start with, but when I went to relationships I kept getting the error message. This morning when I opened the file, I checked to make sure that the columns were the same and when I opened the relationships page it all worked fine. I have no idea what I did wrong, but ultimately it is working and I appreciate your help. I will be more aware of that in the future.
Thanks again,
Bill

OOo 2.2.X on Ms Windows XP

wbgill

Posts: 4
Joined: Thu Sep 04, 2008 9:11 pm


[Solved] Column Types do not match?

I am new to base and I guess it shows! I am trying to create a simple database to help the non-profit Kiwanis club that I belong to track sales for a fund raiser, keep a customer list and create labels for sending out confirmations after they send their checks to us.
I am setting up the following tables: Customers, Members, Orders, Order Details and Products. I thought I was on the right course, but when trying to set up the relationships, I get the following message «Column types do not match in statement [ALTER TABLES «Orders» ADD FOREIGN KEY («Members») REFERENCES «Members» (MemberID»)].
I am frankly at a loss. I thought that perhaps it was referring to field type and I tried changing from numeric to integer for my «ID» numbers, but got a different error message when I tried to save it. Ended up having to delete the table and create it again.
I would appreciate some help if anyone has any ideas. I’m sure it’s something simple, but darned if I can see what I’m doing wrong.
Thank you!
Bill

Last edited by wbgill on Mon Jun 15, 2009 10:36 pm, edited 1 time in total.

OOo 2.2.X on Ms Windows XP

User avatar

r4zoli

Volunteer
Posts: 2882
Joined: Mon Nov 19, 2007 8:23 pm
Location: Budapest, Hungary

Re: Column Types do not match?

Post

by r4zoli » Sat Jun 13, 2009 12:42 pm

«Column types do not match in statement [ALTER TABLES «Orders» ADD FOREIGN KEY («Members») REFERENCES «Members» (MemberID»)

Two fields(colums) type must be same when you creating FK relationship.
«MemberID» in referenced table and «Memebers» in table where you want to connect the other table, must be the same type, for example both must be «Integer» type.

wbgill

Posts: 4
Joined: Thu Sep 04, 2008 9:11 pm


Re: Column Types do not match?

Post

by wbgill » Mon Jun 15, 2009 10:35 pm

Thanks for your response!
I thought that might have been the problem. I did change to integers on all of the ID fields. Think I had numeric to start with, but when I went to relationships I kept getting the error message. This morning when I opened the file, I checked to make sure that the columns were the same and when I opened the relationships page it all worked fine. I have no idea what I did wrong, but ultimately it is working and I appreciate your help. I will be more aware of that in the future.
Thanks again,
Bill

OOo 2.2.X on Ms Windows XP

Автор Syzygy, 10 мая 2010, 13:33

0 Пользователи и 1 гость просматривают эту тему.

При работе с Base заметил, что очень много системных сообщений об ошибках никак не переведено. Пример на скрине (ошибка организации связи между таблицами).
Считаю, что первую часть ошибки, т.е. слова Column types do not match in statement треба перевести. Так как такая ситуация повсеместно, закралась мысль — может, это специально сделано?
Кто что думает?

[вложение удалено Администратором]

A Matter of Life and Death


надо смотреть исходные файлы. Наверное, лучше всего это сделать во время работы над переводом ООо 3.3


Это сообщения HSQLDB. Например, я перевел непереведеные сообщения об ошибках в Postgres, и они появляются на великомогучем. В Base лучше ничего не переводить. Иначе начинается катавасия с терминами.


Согласен!
Если уж очень хочется, можно составить справочник толкований сообщений. Впоследствии из этого справочника можно будет попытаться сделать терминологически согласованный перевод. Но это не скоро.


Собственно, почему тогда в других модулях сообщения об ошибках переведены? Ведь ошибка содержит текст, к примеру, «Первичный ключ не установлен». Почему его нельзя перевести? В чём может быть путаница?

A Matter of Life and Death


Потому что это сообщеие ООО.
Не преведены сообщения, выдаваемые HSQLDB.

Путаницы с сообщением про первичный ключ может и не быть. А вот путаницы, например с обработкой SQLCODE или проверки тригером могут быть и бывают.
Кроме того переводить своства контроов, например, глупо, потому что потом приходится долго втыкать. что имели ввиду переводчики, при работе с англоязычными ресурсами. Те части, которые доступны (используются преимущественно) специалистам, вообще лучше не переводить, чтобы не запутывать терминологию. Кроме того в русском языке все-таки принят контекстный перевод, а не тупой подстрочник. OnBeforeUpdate и OnUpdate свойство как переведете? А переведено как переведено.


Цитата: BigAndy от 22 мая 2010, 17:05Потому что это сообщеие ООО.Не преведены сообщения, выдаваемые HSQLDB.

Это понял, спасибо.

Цитата: BigAndy от 22 мая 2010, 17:05OnBeforeUpdate и OnUpdate свойство как переведете?

Про это никто и не спорит. Я именно про текстовую часть сообщения, которая сообщает, что «Типы столбцов не совпадают [Тут не переведённая инфа про эти столбцы ].

A Matter of Life and Death


I get this error when I try to generate data for my database:

Column name or number of supplied values does not match table definition

This is the structure of my database:

Create database Newsagents;
USE Newsagents;

CREATE TABLE Client (
ClientID int   NOT NULL, 
Name char(30) NOT NULL,
City char(20) DEFAULT NULL,
Type VARCHAR(15) NOT NULL CHECK (type IN('Individual', 'Company'))
PRIMARY KEY (ClientID)
) ;

CREATE TABLE Product (
ProductNumber char(10) NOT NULL,
ProductName char(20) NOT NULL,
Price float NOT NULL,
isAvailable tinyint NOT NULL,
PRIMARY KEY (ProductNumber)
) ;

CREATE TABLE Sales (
ID INT NOT NULL ,
ClientID INT REFERENCES Client(ClientID),
ProductNumber CHAR(10)  REFERENCES Product(ProductNumber),
Quantity INT NOT NULL,
Price FLOAT NOT NULL ,
Date TIMESTAMP NOT NULL,
PRIMARY KEY ( ID ) 
);

ALTER TABLE sales ADD CONSTRAINT d CHECK (Date > CURRENT_TIMESTAMP);
ALTER TABLE sales ADD CONSTRAINT i CHECK (Quantity > 0);

I than fill my database with some values for Client and Product and I want to generate Sales (using values from Client and Product). This is how I do it:

DECLARE @counter INT
DECLARE @quantity int
DECLARE @prodNum varchar(20)
SET @counter = 0 
WHILE @counter < 10  
BEGIN
SET @quantity = (select FLOOR(RAND()*100))
SET @prodNum = (select TOP 1 ProductNumber from Product Order by NEWID())
insert into Sales values(
   (select TOP 1 ClientID from Client Order by NEWID()),
   (select @prodNum),
   (select @quantity),
   ((select @quantity)*(select TOP 1 Price from Product where ProductNumber = @prodNum)),
  DEFAULT
  )
 SET @counter = @counter + 1 
 END 

However I get the Column name or number of supplied values does not match table definition.
What am I doing wrong?

I get this error when I try to generate data for my database:

Column name or number of supplied values does not match table definition

This is the structure of my database:

Create database Newsagents;
USE Newsagents;

CREATE TABLE Client (
ClientID int   NOT NULL, 
Name char(30) NOT NULL,
City char(20) DEFAULT NULL,
Type VARCHAR(15) NOT NULL CHECK (type IN('Individual', 'Company'))
PRIMARY KEY (ClientID)
) ;

CREATE TABLE Product (
ProductNumber char(10) NOT NULL,
ProductName char(20) NOT NULL,
Price float NOT NULL,
isAvailable tinyint NOT NULL,
PRIMARY KEY (ProductNumber)
) ;

CREATE TABLE Sales (
ID INT NOT NULL ,
ClientID INT REFERENCES Client(ClientID),
ProductNumber CHAR(10)  REFERENCES Product(ProductNumber),
Quantity INT NOT NULL,
Price FLOAT NOT NULL ,
Date TIMESTAMP NOT NULL,
PRIMARY KEY ( ID ) 
);

ALTER TABLE sales ADD CONSTRAINT d CHECK (Date > CURRENT_TIMESTAMP);
ALTER TABLE sales ADD CONSTRAINT i CHECK (Quantity > 0);

I than fill my database with some values for Client and Product and I want to generate Sales (using values from Client and Product). This is how I do it:

DECLARE @counter INT
DECLARE @quantity int
DECLARE @prodNum varchar(20)
SET @counter = 0 
WHILE @counter < 10  
BEGIN
SET @quantity = (select FLOOR(RAND()*100))
SET @prodNum = (select TOP 1 ProductNumber from Product Order by NEWID())
insert into Sales values(
   (select TOP 1 ClientID from Client Order by NEWID()),
   (select @prodNum),
   (select @quantity),
   ((select @quantity)*(select TOP 1 Price from Product where ProductNumber = @prodNum)),
  DEFAULT
  )
 SET @counter = @counter + 1 
 END 

However I get the Column name or number of supplied values does not match table definition.
What am I doing wrong?


Description


alvarezp2000


2005-03-17 21:46:36 UTC

I'm trying to add a column as primary key with the following steps:

1. Open the table for Edit.
2. Select a blank row (the next one available).
3. Type "ID" as the field name (tried ID2 also, didn't work).
4. Field type: INTEGER.
5. Right click in the column bar at the left and chose Primary Key.
6. Save the table.

I got the following message:

---
Error connecting to the data source

Column constraints are not acceptable in statement [ALTER TABLE
"t_impresoras" ADD "ID" INTEGER NOT NULL]
---


Comment 2


alvarezp2000


2005-04-22 17:36:59 UTC

Ok, I'm trying to do that with a new database... Looks like it doesn't always 
happen. I'm noticing that it only happens when the table already has data in it.


Comment 3


christoph.lukasiak


2005-04-25 13:05:36 UTC

change owner


Comment 5


alvarezp2000


2005-04-25 21:08:15 UTC

It still happens on m95, which is the latest I can download. You must try it in 
a database that has some data in it.

1. Open the db.
2. Create a table. Put a PK and a field in it. Save it. Close it.
3. Put some data in the table in both fields. (I need only 1 row to reproduce 
it).
4. Reopen for edition. Drop the PK, the entire PK field. Save, close.
5. Reopen for edition. Add PK field again (as PK).
6. On saving, you get the message.

I noticed that if instead I do this:

5. Reopen for edition. Add PK field again (as normal field).
6. Save. <----- Here I don't get the message.
7. Reopen for edition.
8. Set PK field as PK.
9. Save. <----- First I get a message "Warning, the column 'id' cannot be 
changed. Should the column instead be deleted and the new format applied?"
10. Click "Yes".
11. There again the message is.


Comment 6


christoph.lukasiak


2005-04-26 09:54:34 UTC

clu->alvarezp2000: now we have it - the problem is the pk field (drop and
create) - this is a known problem that should be solved with fix of issue 47321

thx

*** This issue has been marked as a duplicate of 47321 ***


Comment 7


christoph.lukasiak


2005-04-26 09:56:20 UTC

close


Comment 8


bencoman


2005-07-31 05:43:45 UTC

Just downloaded OpenOffice today 2005-07-31. Help > About shows version 1.9.118.
This use case relates to issue 45338, which was marked as a duplicate of issue
47321, which was closed on 2005-06-29 saying it should be "in the current
master". From the date in Release Notes footer "1.9.m118_snapshot.html,v 1.2
2005/07/18" I'm guessing I should have the fix, but I'm not sure how 47321's
target milestone of OOo 2.0.1 relates to when the fix is actually released, the
the m118 release ntoes dont mention 47321.

Anyhow, the use case for 1.9.118.....
+ Start > OpenOffice.org 1.9.118 > OpenOffice Base
+ Create New Database <Next>
+ Leave defaults ticked: Yes, register the database for me; Open the database
for editing <Finish>
+ Filename="New Database" <Save>
+ <Create Table in Design View>
+ Add field ( f1, Text [VARCHAR] )
+ <Save> TableName="Table1" <OK>
+ ?Should a primary key be created now? <Yes>
> save appears to be successful
+ Add field ( f2, Integer [INTEGER] ), with AutoValue=Yes
+ Click out of field on next row.
+ <Save> 
>> dialog appears "Error while connecting to the data source. Column constraints
are not acceptable in statement [ALTER TABLE "Table1" ADD "f2" INTEGER IDENTITY]

This comment has been added to both issues 45338 and 47321.
Platform: Windows XP SP2 logged on as Administrator

This is my first contribution - please be gentle :)

Не добавляется foreing key.
Проверил столбцы на null,таблицы пустые,типы подходят,длина тоже
Уже не знаю что делать,завтра курсовая.
Пытаюсь связать prepodName(child) с pr_Fam(parent)
Вот дочерняя таблица

 SHOW CREATE TABLE catec.group
CREATE TABLE `group` (
   `idGroup` int(11) NOT NULL AUTO_INCREMENT,
   `Group_Name` varchar(50) DEFAULT NULL,
   `qualif_Kod` int(11) DEFAULT NULL,
   `prepodName` varchar(100) DEFAULT NULL COMMENT 'Имя препода-куратораn',
   PRIMARY KEY (`idGroup`),
   KEY `fk_qKod_idx` (`qualif_Kod`),
   CONSTRAINT `fk_qKod` FOREIGN KEY (`qualif_Kod`) REFERENCES `qualif` (`qualif_Kod`) ON DELETE NO ACTION ON UPDATE CASCADE
 ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8

Вот родительская таблица

SHOW CREATE TABLE catec.prepod
CREATE TABLE `prepod` (
   `id_prepod` int(11) NOT NULL AUTO_INCREMENT,
   `pr_fam` varchar(100) NOT NULL DEFAULT '',
   `pr_name` varchar(100) DEFAULT NULL,
   `pr_otch` varchar(100) DEFAULT NULL,
   `pr_IIN` bigint(12) DEFAULT NULL,
   `pr_gender` char(1) DEFAULT NULL,
   `pr_DR` date DEFAULT NULL,
   `pr_Email` varchar(100) DEFAULT NULL,
   `pr_YazObuch` varchar(100) DEFAULT NULL,
   `pr_Grajd` varchar(100) DEFAULT NULL,
   `pr_Kateg` varchar(100) DEFAULT NULL,
   `pr_Natsiya` varchar(100) DEFAULT NULL,
   `pr_Tel` varchar(20) DEFAULT NULL,
   `pr_SubName` varchar(100) DEFAULT NULL,
   `pr_Kurat` char(3) DEFAULT NULL COMMENT 'Кураторство:Да,Нетn',
   PRIMARY KEY (`id_prepod`,`pr_fam`)
 ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COMMENT='для преподавателей'

Вот и результат

Executing:

ALTER TABLE `catec`.`group` 
ADD INDEX `fk_prepod_Fam_idx` (`prepodName` ASC);
ALTER TABLE `catec`.`group` 
ADD CONSTRAINT `fk_prepod_Fam`
  FOREIGN KEY (`prepodName`)
  REFERENCES `catec`.`prepod` (`pr_fam`)
  ON DELETE SET NULL
  ON UPDATE CASCADE;

Operation failed: There was an error while applying the SQL script to the database.
ERROR 1215: Cannot add foreign key constraint
SQL Statement:
ALTER TABLE `catec`.`group` 
ADD CONSTRAINT `fk_prepod_Fam`
  FOREIGN KEY (`prepodName`)
  REFERENCES `catec`.`prepod` (`pr_fam`)
  ON DELETE SET NULL
  ON UPDATE CASCADE

Также,при команде SHOW engine InnoDB status
выдает следующее:

Cannot find an index in the referenced table where the
 referenced columns appear as the first columns, or column types
 in the table and the referenced table do not match for constraint.
 Note that the internal storage type of ENUM and SET changed in
 tables created with >= InnoDB-4.1.12, and such columns in old tables
 cannot be referenced by such columns in new tables.

I’m trying to create a foreign key in mysql workbench, but keep getting this error:

mysql workbench message when trying to create foreign key

I’ve checked the columns on both tables, and they match up as well as I can make them. One is CHAR(21) not null primary key, and the other is CHAR(21) not null.

Edit (again): (both tables)

First, the original table that I’m trying to link to:

    CREATE TABLE IF NOT EXISTS `db`.`Employee` (
      `employeeId` CHAR(21) NOT NULL,
      `departmentId` CHAR(21) NULL DEFAULT NULL,
      `chatStatusId` CHAR(21) NOT NULL DEFAULT 'd15a558946afbbd4a6046',
      `employeeNum` INT(4) NOT NULL,
      `payrollNum` INT(11) UNSIGNED NULL DEFAULT '0',
      `title` VARCHAR(50) NULL DEFAULT NULL,
      `dateHired` DATE NOT NULL,
      `terminationDate` DATE NULL DEFAULT NULL,
      `LastLogin` DATETIME NULL DEFAULT NULL,
      `rightMask` INT(11) NOT NULL COMMENT 'we should be using the right table instead',
      `teamId` INT(11) UNSIGNED NULL DEFAULT NULL COMMENT 'this is no longer really used',
      `IsTeamLead` TINYINT(4) NOT NULL DEFAULT '0',
      `bioId` INT(11) UNSIGNED NULL DEFAULT NULL,
      `emailSignature` TEXT NULL DEFAULT NULL,
      `notes` TEXT NULL DEFAULT NULL,
      PRIMARY KEY (`employeeId`),
      UNIQUE INDEX `employeeNum` (`employeeNum` ASC),
      INDEX `departmentId` (`departmentId` ASC),
      INDEX `chatStatusId` (`chatStatusId` ASC),
      INDEX `teamId` (`teamId` ASC),
      CONSTRAINT `Employee_ibfk_1`
        FOREIGN KEY (`employeeId`)
        REFERENCES `db`.`Person` (`personId`)
        ON DELETE CASCADE
        ON UPDATE CASCADE,
      CONSTRAINT `Employee_ibfk_10`
        FOREIGN KEY (`teamId`)
        REFERENCES `db`.`HaloTeam` (`teamId`)
        ON DELETE RESTRICT
        ON UPDATE RESTRICT,
      CONSTRAINT `Employee_ibfk_8`
        FOREIGN KEY (`departmentId`)
        REFERENCES `db`.`Department` (`departmentId`),
      CONSTRAINT `Employee_ibfk_9`
        FOREIGN KEY (`chatStatusId`)
        REFERENCES `db`.`ChatStatus` (`chatStatusId`)
        ON DELETE RESTRICT
        ON UPDATE RESTRICT)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1
COLLATE = latin1_general_ci

And this is the new table I’m trying to create a foreign key on to the original table:

CREATE TABLE IF NOT EXISTS `db`.`ArticleNote` (
  `ArticleNoteID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `ArticleID` INT(10) UNSIGNED NOT NULL,
  `Created` TIMESTAMP NOT NULL,
  `employeeId` CHAR(21) NOT NULL,
  `Note` VARCHAR(255) NOT NULL,
  PRIMARY KEY (`ArticleNoteID`),
  INDEX `fk_ANote_Article_idx` (`ArticleID` ASC),
  INDEX `fk_ANote_Employee_idx` (`employeeId` ASC),
  CONSTRAINT `fk_ANote_Article`
    FOREIGN KEY (`ArticleID`)
    REFERENCES `db`.`Article` (`ArticleID`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_ANote_Employee`
    FOREIGN KEY ()
    REFERENCES `db`.`Employee` ()
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1
COLLATE = latin1_general_ci

And this is an example of a table that already has a foreign key (using the same column) as the one I’m trying to create in my new table:

CREATE TABLE IF NOT EXISTS `db`.`Article` (
  `ArticleID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `ArticleCategoryID` INT(10) UNSIGNED NOT NULL DEFAULT 1,
  `Url` VARCHAR(120) NOT NULL,
  `Title` VARCHAR(60) NOT NULL,
  `Summary` VARCHAR(255) NOT NULL,
  `Image` VARCHAR(200) NULL,
  `StatusIDE` INT(11) NOT NULL,
  `AreaIDE` INT(11) NULL,
  `CreatedAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `CreatedBy` CHAR(21) NULL DEFAULT NULL,
  `ExpiresAt` TIMESTAMP NULL DEFAULT NULL,
  `PayoutAmount` DECIMAL(11,2) NOT NULL DEFAULT 0.00,
  PRIMARY KEY (`ArticleID`),
  INDEX `fk_Aritcle_Category_idx` (`ArticleCategoryID` ASC),
  INDEX `fk_Article_Status_idx` (`StatusIDE` ASC),
  INDEX `fk_Article_Area_idx` (`AreaIDE` ASC),
  INDEX `fk_Article_Employee1_idx` (`CreatedBy` ASC),
  CONSTRAINT `fk_Article_Employee1`
    FOREIGN KEY (`CreatedBy`)
    REFERENCES `db`.`Employee` (`employeeId`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_Article_ArtCat1`
    FOREIGN KEY (`ArticleCategoryID`)
    REFERENCES `db`.`ArticleCategory` (`ArticleCategoryID`)
    ON DELETE RESTRICT
    ON UPDATE CASCADE,
  CONSTRAINT `fk_Article_Status`
    FOREIGN KEY (`StatusIDE`)
    REFERENCES `db`.`DatabaseEnum` (`DatabaseEnumID`)
    ON DELETE RESTRICT
    ON UPDATE CASCADE,
  CONSTRAINT `fk_Article_Area`
    FOREIGN KEY (`AreaIDE`)
    REFERENCES `db`.`DatabaseEnum` (`DatabaseEnumID`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1
COLLATE = latin1_general_ci

Автор Syzygy, 10 мая 2010, 13:33

0 Пользователи и 1 гость просматривают эту тему.

При работе с Base заметил, что очень много системных сообщений об ошибках никак не переведено. Пример на скрине (ошибка организации связи между таблицами).
Считаю, что первую часть ошибки, т.е. слова Column types do not match in statement треба перевести. Так как такая ситуация повсеместно, закралась мысль — может, это специально сделано?
Кто что думает?

[вложение удалено Администратором]

A Matter of Life and Death


надо смотреть исходные файлы. Наверное, лучше всего это сделать во время работы над переводом ООо 3.3


Это сообщения HSQLDB. Например, я перевел непереведеные сообщения об ошибках в Postgres, и они появляются на великомогучем. В Base лучше ничего не переводить. Иначе начинается катавасия с терминами.


Согласен!
Если уж очень хочется, можно составить справочник толкований сообщений. Впоследствии из этого справочника можно будет попытаться сделать терминологически согласованный перевод. Но это не скоро.


Собственно, почему тогда в других модулях сообщения об ошибках переведены? Ведь ошибка содержит текст, к примеру, «Первичный ключ не установлен». Почему его нельзя перевести? В чём может быть путаница?

A Matter of Life and Death


Потому что это сообщеие ООО.
Не преведены сообщения, выдаваемые HSQLDB.

Путаницы с сообщением про первичный ключ может и не быть. А вот путаницы, например с обработкой SQLCODE или проверки тригером могут быть и бывают.
Кроме того переводить своства контроов, например, глупо, потому что потом приходится долго втыкать. что имели ввиду переводчики, при работе с англоязычными ресурсами. Те части, которые доступны (используются преимущественно) специалистам, вообще лучше не переводить, чтобы не запутывать терминологию. Кроме того в русском языке все-таки принят контекстный перевод, а не тупой подстрочник. OnBeforeUpdate и OnUpdate свойство как переведете? А переведено как переведено.


Цитата: BigAndy от 22 мая 2010, 17:05Потому что это сообщеие ООО.Не преведены сообщения, выдаваемые HSQLDB.

Это понял, спасибо.

Цитата: BigAndy от 22 мая 2010, 17:05OnBeforeUpdate и OnUpdate свойство как переведете?

Про это никто и не спорит. Я именно про текстовую часть сообщения, которая сообщает, что «Типы столбцов не совпадают [Тут не переведённая инфа про эти столбцы ].

A Matter of Life and Death


Gigazo1d

2 / 2 / 0

Регистрация: 10.01.2013

Сообщений: 167

1

07.04.2014, 16:08. Показов 8049. Ответов 6

Метки нет (Все метки)


Студворк — интернет-сервис помощи студентам

Условие: В магазине продаются 7 книг разных авторов и разной цены. Составить программу вывода сообщения об авторе, название и цены книги, в зависимости от введённого порядкового номера книги.

Pascal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Program knigi;
var book: integer;number:array[1..7] of string;
begin
number[1]:='Инфа о книге писателе и цене';
number[2]:='Инфа о книге писателе и цене';
number[3]:='Инфа о книге писателе и цене';
number[4]:='Инфа о книге писателе и цене';
number[5]:='Инфа о книге писателе и цене';
number[6]:='Инфа о книге писателе и цене';
number[7]:='Инфа о книге писателе и цене';
write('Введите номер книги');
readln(book);
writeln('бла-бла');
case book of '1'..'7':writeln('Инфа по книге-',number[book]);
else writeln('Вы ввели не правильное значение')'
end;
writeln('бла-бла');
end.

‘1’..’7′ — в этом месте выдает ошибку с текстом «constant and case types do not match»

Код программы загнал в текстовик т.к. почему то не мог опубликовать тему(пишет произошла ошибка)
П.С. текстовик уже не актуален)

Вложения

Тип файла: txt прога.txt (684 байт, 0 просмотров)



0



Puporev

Почетный модератор

64288 / 47587 / 32739

Регистрация: 18.05.2008

Сообщений: 115,182

07.04.2014, 16:21

2

Pascal
1
2
3
4
5
6
case book of
1..7:writeln('Èíôà ïî êíèãå-',number[book]);
else writeln('Âû ââåëè íå ïðàâèëüíîå çíà÷åíèå');
end;
writeln('áëà-áëà');
end.

1..7 тип integer, а не char



0



2 / 2 / 0

Регистрация: 10.01.2013

Сообщений: 167

08.04.2014, 09:59

 [ТС]

3

Цитата
Сообщение от Puporev
Посмотреть сообщение

1..7 тип integer, а не char

Спасибо заработало, программа запускается, просит ввести номер книги как и задумано, после ввода выкидывает на код, после очередного запуска показывается информация по очередному номеру(который вводишь перед тем как выкидывает) что не так сделал?)



0



Почетный модератор

64288 / 47587 / 32739

Регистрация: 18.05.2008

Сообщений: 115,182

08.04.2014, 10:01

4

перед последним end.
напиши readln и будет просмотр, а выход по Enter



0



2 / 2 / 0

Регистрация: 10.01.2013

Сообщений: 167

08.04.2014, 10:22

 [ТС]

5

Цитата
Сообщение от Puporev
Посмотреть сообщение

перед последним end.
напиши readln и будет просмотр, а выход по Enter

Уже лучше, информация выводится после ввода номера, но при попытке ввода еще одного номера, так же выкидывает на код. Что еще можно сделать чтобы можно было дальше вводить номера?



0



Puporev

Почетный модератор

64288 / 47587 / 32739

Регистрация: 18.05.2008

Сообщений: 115,182

08.04.2014, 10:31

6

Лучший ответ Сообщение было отмечено Gigazo1d как решение

Решение

Pascal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
uses crt;
var book: integer;
    number:array[1..7] of string;
    c:char;
begin
number[1]:='Инфа о книге писателе и цене';
number[2]:='Инфа о книге писателе и цене';
number[3]:='Инфа о книге писателе и цене';
number[4]:='Инфа о книге писателе и цене';
number[5]:='Инфа о книге писателе и цене';
number[6]:='Инфа о книге писателе и цене';
number[7]:='Инфа о книге писателе и цене';
repeat
clrscr;
write('Введите номер книги');
readln(book);
case book of
1..7:writeln('Инфа по книге-',number[book]);
else writeln('Вы ввели не правильное значение');
end;
writeln('Повторить y/Y-да, n/N-нет');
repeat
readln(c);
until upcase(c) in ['Y','N'];
until upcase(c)='N';
end.



1



2 / 2 / 0

Регистрация: 10.01.2013

Сообщений: 167

08.04.2014, 12:13

 [ТС]

7

Puporev, Большое Вам человеческое спасибо)



0



The column name or number of supplied values does not match table definition. You will encounter this SQL server mistake when the supplied values do not match table definitions, forcing your system to launch the column types do not match in statement alter code exception.column name or number of supplied values does not match table definition

As a result, we compiled this comprehensive debugging guide that should help you remove the column name or number of supplied values does not match table definition in C# error without further complications. In addition, we will exemplify the column names that produce this SQL server error.

Contents

  • Why Is the Column Name or Number of Supplied Values Does Not Match?
    • – Executing a Specific Query for the Tables
    • – Creating a Database Project
  • Fix the Column Name or Number of Supplied Values Does Not Match
    • – Enhancing the Additional Field and Restoring Its Properties
  • Conclusion

The column name or number of supplied values does not match table definition merge because the provided values for the columns do not check the table definition. As a result, inserting values inside the table is impossible because the string or binary data would be truncated.

For example, this server error is almost inevitable when using the insert into the property from one table to another without correct inputs. As a result, the system displays that the column name or number of supplied values does not match table definition. stored procedure, blocking further code alterations.

In addition, you can have a perfect match table without broken values, but the program will fail unless the columns have unique names and properties. This means the columns in your script have a different structure, confusing the application because the following data type properties of column do not match.

So, you cannot complete the application or program and insert the values from one place to another unless you remove the error. Hence, we will show you several scripts that recreate the column name or number of supplied values does not match table definition. temp table, which is vital when troubleshooting the inputs.

In addition, you can compare the syntaxes to your document and locate the broken values. Fortunately, the debugging approaches and methods apply to all documents, no matter how different or unique the elements are.

– Executing a Specific Query for the Tables

The former chapter confirmed you would likely experience this code exception when executing a specific query for the tables in your project. Considering that, we will show you the complete syntax to help you locate the incorrect values, which can be similar to your project.Column Name or Number of Supplied Values Does Not Match Table Definition Causes

The following example executes the query:

USE XYZ

— to restore dbs from the backup file

SET NOCOUNT on;

DECLARE @level varchar(1450)

DECLARE @commandDBName varchar(1450)

DECLARE @RowCnt int

DECLARE @MaxRow int;

DECLARE @Table TABLE (rownum int IDENTITY (1, 2) Primary key is NOT NULL,LogicalName varchar(291),[PhysicalName] varchar(291), [Type] varchar(5), [FileGroupName] varchar(291), [Size] varchar(291),

[MaxSize] varchar(291), [FileId]varchar(291), [CreateLSN]varchar(291), [DropLSN]varchar(291), [UniqueId]varchar(291), [ReadOnlyLSN]varchar(291), [ReadWriteLSN]varchar(291),

[BackupSizeInBytes]varchar(291), [SourceBlockSize]varchar(291), [FileGroupId]varchar(291), [LogGroupGUID]varchar(291), [DifferentialBaseLSN]varchar(291), [DifferentialBaseGUID]varchar(291), [IsReadOnly]varchar(291), [IsPresent]varchar(291), [TDEThumbprint]varchar(291)

)

Declare @FileName varChar(291)

Select @BKFolder = ‘G:SQLMSSQLSERVERBackupXYZ’

set @FileName = null

set @cmdText = null

Declare @FileList table (

FileNames varchar(344),

DepthFlag int,

FileFlag int

)

–get all the elements and folders in the backup folder and put them in current table

insert into @FileList exec xp_tree @BKFolder,0,1

select top 2 @FileNames = @BKFolder + FileNames from @FileList where the Filenames like ‘Server1_XYZ_FULL%.bak’ order by FileNames desc

–select @filename

declare @backupfile as Varchar(291)

SELECT @level = [compatibility_level]

FROM DISK=”’ +@filename+ ”’

‘);

SELECT * from @Table

Msg 314, Level 21, State 7, Line 4

Column name or number of provided inputs does not match the table definition.

Msg 2091, Level 15, State 2, Line 5

RESTORE FILELIST is terminating abnormally

The last few code lines confirm issues with the project and launch the exact column name mistake. Unfortunately, this is one of the many instances of ruining your application.

– Creating a Database Project

The program launches the broken message when creating a database project with several tables and procedures. For example, the tables generate scripts, adding several inputs inside the snippets. Unfortunately, the operation fails, and your code remains unfunctional.

You can learn more about the script in the following example:

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[KlienciIndywidualni](

[IDKlientaIndywidualnego] [int] IDENTITY (1,1) NOT NULL,

[IDKlienta] [int] NOT NULL,

[Imie] [nvarchar] (50) NOT NULL,

[Nazwisko] [nvarchar] (50) NOT NULL,

[NumerLegitymacji] [int] NULL,

[Adres] [nvarchar] (50) NOT NULL,

[Miasto] [nvarchar] (50) NOT NULL,

[KodPocztowy] [nvarchar] (50) NOT NULL,

[Kraj] [nvarchar] (50) NOT NULL,

[Telefon] [int] NOT NULL,

[Email] [nvarchar] (50) NOT NULL,

CONSTRAINT [PK_KlienciIndywidualni] PRIMARY KEY CLUSTERED

(

[IDKlientaIndywidualnego] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY]

GO

ALTER TABLE [dbo]. [KlienciIndywidualni] WITH CHECK ADD CONSTRAINT [FK_KlienciIndywidualni_Klienci] FOREIGN KEY ([IDKlienta])

REFERENCES [dbo]. [Klienci] ([IDKlienta])

GO

ALTER TABLE [dbo]. [KlienciIndywidualni] CHECK CONSTRAINT [FK_KlienciIndywidualni_Klienci]

GO

ALTER TABLE [dbo]. [KlienciIndywidualni] WITH CHECK ADD CONSTRAINT [CK_KlienciIndywidualni] CHECK ((len ([Telefon])> = (9)))

GO

ALTER TABLE [dbo]. [KlienciIndywidualni] CHECK CONSTRAINT [CK_KlienciIndywidualni]

GO

ALTER TABLE [dbo]. [KlienciIndywidualni] WITH CHECK ADD CONSTRAINT [CK_KlienciIndywidualni_mail] CHECK (([Email] like ‘%@%.[a-z][a-z][a-z]’))

GO

ALTER TABLE [dbo]. [KlienciIndywidualni] CHECK CONSTRAINT [CK_KlienciIndywidualni_mail]

GO

As you can tell, although the procedure appears functional and capable of handling the operations, it blocks your code and halts further processes. We will teach you how to repair the code, but we suggest isolating the broken code snippet from the rest of the document.

Fix the Column Name or Number of Supplied Values Does Not Match

You can fix the column name or number of supplied values does not match using the same structure and inputs for all columns and tables. As a result, it would help if you used the drop table property and inserted the proper names for each table when moving the values.

You can use the dynamic SQL query, and although it is not the best, it solves the error and reenables all processes. You can learn more about the possible solution in the following example:

declare @sql nvarchar(max)

DECLARE @DB_SPACE TABLE (

[DatabaseName] NVARCHAR (281) NOT NULL,

[FILEID] [smallint] NOT NULL,

[FILE_SIZE_MB] INT NOT NULL DEFAULT (1),

[SPACE_USED_MB] INT NULL DEFAULT (2),

[FREE_SPACE_MB] INT NULL DEFAULT (3),

[LOGICALNAME] SYSNAME NOT NULL,

[DRIVE] NCHAR(2) NOT NULL,

[FILENAME] NVARCHAR (192) NOT NULL,

[FILE_TYPE] NVARCHAR (301) NOT NULL,

[THE_AUTOGROWTH_IN_MB] INT NOT NULL DEFAULT(1)

,filegroup VARCHAR (291)

,maxsize VARCHAR (31)

PRIMARY KEY CLUSTERED ([Database], [FILEID] )

)

SELECT @SQL =’SELECT [Database],

[FILE_ID],

[FILE_SIZE_KB],

[SPACE_USED_KB],

[FREE_SPACE_KB],

[LOGICALNAMES],

[DRIVE],

[FILENAMES],

[FILE_TYPES],

[THE_AUTOGROWTH_IN_MB]

,filegroup

,maxsize FROM THE OPENQUERY (‘+ QUOTENAME (‘THE_MONITOR’) + ‘,”’+ ‘ EXEC MASTER.monitoring_database_details ‘ +”’)’

exec sp_executesql @sql

INSERT INTO @DB_SPACE(

[DatabaseName],

[FILEID],

[FILE_SIZE_KB],

[SPACE_USED_KB],

[FREE_SPACE_KB],

[LOGICALNAMES],

[DRIVE],

[FILENAMES],

[FILE_TYPE],

THE_AUTOGROWTH_IN_KB,

[filegroup],

maxsize

)

EXEC SP_EXECUTESQL @SQL

So, this code snippet confirms the number and type of columns returned by the stored procedure are identical because we produce the same table. You can obliterate the code exception by enhancing the additional field and restoring its properties which takes only a minute to complete.

– Enhancing the Additional Field and Restoring Its Properties

The second debugging approach teaches you how to enhance the extra field and restore the properties to remove the exception. Luckily, this script is not complicated, and you can quickly replicate it in your document, as shown below:Enhancing the Additional Field and Restoring Its Properties

SET @query = ‘RESTORE FILEONLY FROM DISK = ‘ + QUOTENAMES(@BackupFile , ””)

CREATE TABLE #restoretemp

(

LogicalName nvarchar(218)

,PhysicalName nvarchar(291)

,[Type] char(2)

,FileGroupName nvarchar(201)

,[Size] numeric(35,0)

,[MaxSize] numeric(35,0)

,FileID bigint

,CreateLSN numeric(40,0)

,DropLSN numeric(30,0) NULL

,UniqueID uniqueidentifier

,ReadOnlyLSN numeric(40,0)

,ReadWriteLSN numeric(30,0)

,BackupSizeInByte bigint

,SourceBlockSize int

,FilegroupID int

,LogGroupGUID uniqueidentifier NULL

,DifferentialBaseLSN numeric(40,0)

,DifferentialbaseGUID uniqueidentifier

,IsReadOnly bit

,IsPresent bit

,TDEThumbprint varbinary(40)

— Added field 01.10.2022 needed from SQL Server 2016 (Azure URL)

,SnapshotURL nvarchar(291)

)

INSERT #restoretemp EXEC (@query)

SET @errorstat = @@ERROR

if @errorstat <> 0

Begin

if @Rueckgabe = 0 SET @Rueckgabe = 6

End

Print @Rueckgabe

This is everything your application needs to function correctly without throwing the exception and blocking your project. Still, remember to apply this approach to all broken code snippets.

Conclusion

We encountered this server mistake when the supplied values did not match table definitions, forcing your system to launch the column type code exception. However, this guide will help you remove the error in no time, so let’s revise the critical points:

  • This error will likely affect your program if you have more tables
  • The table names and columns must have appropriate IDs and paths
  • You can recreate the error by executing a specific table query
  • Enhancing the additional field and restoring its properties fixes the mistake

After reading this in-depth debugging guide, you can quickly get around this code exception. In addition, you will likely avoid the same error in the future due to the functional properties.

  • Author
  • Recent Posts

Position is Everything

Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL. Meet The Team

Position is Everything

Понравилась статья? Поделить с друзьями:
  • Column ambiguously defined oracle ошибка
  • Color laserjet pro mfp m176n ошибка сканера 22
  • Cocmainwin32 exe ошибка call of cthulhu как исправить
  • Color laser jet pro mfp m377dw ошибка 59 f0
  • Cobian backup теневое копирование ошибка