Ошибка 213 sql

Error message 213 is a common error that happens when you try to insert values into a table without explicitly specifying the column names.

Error message 213 is a common error that happens when you try to insert values into a table without explicitly specifying the column names.

The error looks like this:

Msg 213, Level 16, State 1, Line 1
Column name or number of supplied values does not match table definition.

It occurs when you specify the wrong number of values for that table. In other words, the number of values you provide doesn’t match the number of columns in the table.

Example

Here’s an example to demonstrate.

INSERT INTO Customers
VALUES ('Jake');

Result:

Msg 213, Level 16, State 1, Line 1
Column name or number of supplied values does not match table definition.

In my case, the problem is that the table actually contains three columns. My table definition looks like this:

CREATE TABLE Customers (
CustomerId int IDENTITY(1,1) NOT NULL,
FirstName nvarchar(255),
LastName nvarchar(255)
);

I’m trying to insert a value, but SQL Server doesn’t know which column it should go into, hence the error.

I would also get the same error if I tried to insert too many values. For example, the following also produces the same error.

INSERT INTO Customers
VALUES ('Jake', 'Smith', 'New York', 'USA');

Result:

Msg 213, Level 16, State 1, Line 1
Column name or number of supplied values does not match table definition.

How to Fix the Error

One way to fix this, is to ensure that the number of values you try to insert actually matches the number of columns in the table.

A better way to do it is explicitly specify the column names in your INSERT statement. Doing this will ensure you don’t accidentally insert data into the wrong columns.

So depending on which values I want to insert, I could rewrite my example to this:

INSERT INTO Customers (FirstName)
VALUES ('Jake');

Or this:

INSERT INTO Customers (FirstName, LastName)
VALUES ('Jake', 'Smith');

Implicit Column Names

As mentioned, it’s better to explicitly spell out each column name in your INSERT statement (as I did in the previous example).

I could however, change my example to use implicit column names, like this:

INSERT INTO Customers
VALUES (1, 'Jake', 'Smith');

However, this could now cause a separate issue regarding the identity column. See How to Insert an Explicit Value into an Identity Column if you need to do this.

Home > SQL Server Error Messages > Msg 213 — Insert Error: Column name or number of supplied values does not match table definition.

SQL Server Error Messages — Msg 213 — Insert Error: Column name or number of supplied values does not match table definition.

SQL Server Error Messages — Msg 213

Error Message

Server: Msg 213, Level 16, State 1, Line 1
Insert Error: Column name or number of supplied values 
does not match table definition.

Causes:

This error occurs when doing an INSERT where the columns list is not specified and the values being inserted, either through the VALUES clause or through a SELECT subquery, are either more than or less than the columns in the table.  Here are examples on when the error can occur:

-- Sample #1: Using INSERT INTO ... VALUES
CREATE TABLE [dbo].[Customers] ( [ID] INT, [Name] VARCHAR(100))

INSERT INTO [dbo].[Customers]
VALUES (1, 'John', 'Doe')

-- Sample #2: Using INSERT INTO ... SELECT FROM
CREATE TABLE [dbo].[Client] ( [ID] INT, [Name] VARCHAR(100))

INSERT INTO [dbo].[Client]
SELECT [ID], [Name], [Address]
FROM [dbo].[NewClient]

Solution / Work Around:

To avoid this problem, make sure that the values specified in the VALUES clause
or in the SELECT subquery match the number of columns in the INSERT
clause.  In addition to this, you must specify the columns in
the INSERT INTO clause.  Although the column list in the INSERT INTO
statement is optional, it is recommended that it is always specified so that
even if there are any modifications made on the table, either new columns are
added or inserted in the middle of the table or columns are deleted, the INSERT
statement will not generate this error.  (Of course, a different error
message will be generated if a column is deleted from the table that is being
referenced by the INSERT statement).

Given the samples above, here’s how to avoid the error:

-- Sample #1: Using INSERT INTO ... VALUES
CREATE TABLE [dbo].[Customers] ( [ID] INT, [Name] VARCHAR(100))

INSERT INTO [dbo].[Customers] ( [ID], [Name] )
VALUES (1, 'John Doe')

-- Sample #2: Using INSERT INTO ... SELECT FROM
CREATE TABLE [dbo].[Client] ( [ID] INT, [Name] VARCHAR(100))

INSERT INTO [dbo].[Client] ( [ID], [Name] )
SELECT [ID], [Name]
FROM [dbo].[NewClient]
Related Articles :
  • Frequently Asked Questions — SQL Server Error Messages
  • Frequently Asked Questions — INSERT Statement
  • Frequently Asked Questions — SELECT Statement

here is my code 

CREATE PROCEDURE [dbo].[pr_ETL_Create_StagingTable_Icd9_042] 

AS
BEGIN

SET NOCOUNT ON;

IF OBJECT_ID(‘Icd9_042’) IS NOT NULL
DROP TABLE Icd9_042 

CREATE TABLE [dbo].[Icd9_042]
(
[TableID] [int] NULL,[KEY] [bigint] NULL,[AGE] [int] NULL,[AGEDAY] [int] NULL,[AMONTH] [int] NULL,
[ASOURCE] [int] NULL,[ASOURCEUB92] [varchar](1) NULL,[ASOURCE_X] [varchar](8) NULL,[ATYPE] [int] NULL,
[AWEEKEND] [int] NULL,[DIED] [int] NULL,[DISCWT] [decimal](11, 7) NULL,[DISPUB92] [int] NULL,
[DISPUNIFORM] [int] NULL,[DQTR] [int] NULL,[DRG] [int] NULL,
[DRGVER] [int] NULL,[DSHOSPID] [varchar](13) NULL,[DX1] [varchar](5) NULL,[DX2] [varchar](5) NULL,
[DX3] [varchar](5) NULL,[DX4] [varchar](5) NULL,[DX5] [varchar](5) NULL,[DX6] [varchar](5) NULL,
[DX7] [varchar](5) NULL,[DX8] [varchar](5) NULL,[DX9] [varchar](5) NULL,[DX10] [varchar](5) NULL,
[DX11] [varchar](5) NULL,[DX12] [varchar](5) NULL,[DX13] [varchar](5) NULL,[DX14] [varchar](5) NULL,
[DX15] [varchar](5) NULL,[DXCCS1] [int] NULL,[DXCCS2] [int] NULL,[DXCCS3] [int] NULL,
[DXCCS4] [int] NULL,[DXCCS5] [int] NULL,[DXCCS6] [int] NULL,[DXCCS7] [int] NULL,
[DXCCS8] [int] NULL,[DXCCS9] [int] NULL,[DXCCS10] [int] NULL,[DXCCS11] [int] NULL,
[DXCCS12] [int] NULL,[DXCCS13] [int] NULL,[DXCCS14] [int] NULL,[DXCCS15] [int] NULL,
[ECODE1] [varchar](5) NULL,[ECODE2] [varchar](5) NULL,[ECODE3] [varchar](5) NULL,[ECODE4] [varchar](5) NULL,
[E_CCS1] [int] NULL,[E_CCS2] [int] NULL,[E_CCS3] [int] NULL,[E_CCS4] [int] NULL,
[ELECTIVE] [int] NULL,[FEMALE] [int] NULL,[HOSPID] [int] NULL,[HOSPST] [varchar](2) NULL,
[LOS] [int] NULL,[LOS_X] [int] NULL,[MDC] [int] NULL,
[MDNUM1_R] [int] NULL,[MDNUM2_R] [int] NULL,[NDX] [int] NULL,[NECODE] [int] NULL,
[NEOMAT] [int] NULL,[NIS_STRATUM] [int] NULL,[NPR] [int] NULL,[PAY1] [int] NULL,
[PAY1_X] [varchar](10) NULL,[PAY2] [int] NULL,[PAY2_X] [varchar](10) NULL,[PL_UR_CAT4] [int] NULL,
[PR1] [varchar](4) NULL,[PR2] [varchar](4) NULL,[PR3] [varchar](4) NULL,[PR4] [varchar](4) NULL,
[PR5] [varchar](4) NULL,[PR6] [varchar](4) NULL,[PR7] [varchar](4) NULL,[PR8] [varchar](4) NULL,
[PR9] [varchar](4) NULL,[PR10] [varchar](4) NULL,[PR11] [varchar](4) NULL,[PR12] [varchar](4) NULL,
[PR13] [varchar](4) NULL,[PR14] [varchar](4) NULL,[PR15] [varchar](4) NULL,[PRCCS1] [int] NULL,
[PRCCS2] [int] NULL,[PRCCS3] [int] NULL,[PRCCS4] [int] NULL,[PRCCS5] [int] NULL,
[PRCCS6] [int] NULL,[PRCCS7] [int] NULL,[PRCCS8] [int] NULL,[PRCCS9] [int] NULL,
[PRCCS10] [int] NULL,[PRCCS11] [int] NULL,[PRCCS12] [int] NULL,[PRCCS13] [int] NULL,
[PRCCS14] [int] NULL,[PRCCS15] [int] NULL,[PRDAY1] [int] NULL,[PRDAY2] [int] NULL,
[PRDAY3] [int] NULL,[PRDAY4] [int] NULL,[PRDAY5] [int] NULL,[PRDAY6] [int] NULL,
[PRDAY7] [int] NULL,[PRDAY8] [int] NULL,[PRDAY9] [int] NULL,[PRDAY10] [int] NULL,
[PRDAY11] [int] NULL,[PRDAY12] [int] NULL,[PRDAY13] [int] NULL,[PRDAY14] [int] NULL,
[PRDAY15] [int] NULL,[RACE] [int] NULL,[TOTCHG] [int] NULL,[TOTCHG_X] [decimal](15, 2) NULL,
[YEAR] [int] NULL,[ZIPInc_Qrtl] [int] NULL
)

INSERT INTO [dbo].[Icd9_042]
SELECT
[ID],[KEY],[AGE],[AGEDAY],[AMONTH],[ASOURCE],[ASOURCEUB92],[ASOURCE_X],[ATYPE],[AWEEKEND],[DIED],[DISCWT]
      ,[DISPUB92],[DISPUNIFORM],[DQTR],[DRG],[DRGVER],[DSHOSPID],[DX1],[DX2],[DX3],[DX4],[DX5],[DX6],[DX7]
      ,[DX8],[DX9],[DX10],[DX11],[DX12],[DX13],[DX14],[DX15],[DXCCS1],[DXCCS2],[DXCCS3],[DXCCS4],[DXCCS5],[DXCCS6]
      ,[DXCCS7],[DXCCS8],[DXCCS9],[DXCCS10],[DXCCS11],[DXCCS12],[DXCCS13],[DXCCS14],[DXCCS15],[ECODE1],[ECODE2]
      ,[ECODE3],[ECODE4],[E_CCS1],[E_CCS2],[E_CCS3],[E_CCS4],[ELECTIVE],[FEMALE],[HOSPID],[HOSPST],[LOS],[LOS_X]
      ,[MDC],[MDNUM1_R],[MDNUM2_R],[NDX],[NECODE],[NEOMAT],[NIS_STRATUM],[NPR],[PAY1],[PAY1_X],[PAY2]
      ,[PAY2_X],[PL_UR_CAT4],[PR1],[PR2],[PR3],[PR4],[PR5],[PR6],[PR7],[PR8],[PR9],[PR10],[PR11],[PR12],[PR13]
      ,[PR14],[PR15],[PRCCS1],[PRCCS2],[PRCCS3],[PRCCS4],[PRCCS5],[PRCCS6],[PRCCS7],[PRCCS8],[PRCCS9],[PRCCS10]
      ,[PRCCS11],[PRCCS12],[PRCCS13],[PRCCS14],[PRCCS15],[PRDAY1],[PRDAY2],[PRDAY3],[PRDAY4],[PRDAY5],[PRDAY6]
      ,[PRDAY7],[PRDAY8],[PRDAY9],[PRDAY10],[PRDAY11],[PRDAY12],[PRDAY13],[PRDAY14],[PRDAY15],[RACE],[TOTCHG]
      ,[TOTCHG_X],[YEAR],[ZIPInc_Qrtl]
FROM dbo.[2004_Nis]
WHERE ‘042’ IN (DX1,DX2,DX3,DX4,DX5,DX6,DX7,DX8,DX9,DX10,DX11,DX12,DX13,DX14,DX15)

INSERT INTO [dbo].[Icd9_042] 
SELECT
[ID],[KEY],[AGE],[AGEDAY],[AMONTH],[ASOURCE],[ASOURCEUB92],[ASOURCE_X],[ATYPE],[AWEEKEND],[DIED],[DISCWT]
      ,[DISPUB92],[DISPUNIFORM],[DQTR],[DRG],[DRGVER],[DSHOSPID],[DX1],[DX2],[DX3],[DX4],[DX5],[DX6],[DX7]
      ,[DX8],[DX9],[DX10],[DX11],[DX12],[DX13],[DX14],[DX15],[DXCCS1],[DXCCS2],[DXCCS3],[DXCCS4],[DXCCS5],[DXCCS6]
      ,[DXCCS7],[DXCCS8],[DXCCS9],[DXCCS10],[DXCCS11],[DXCCS12],[DXCCS13],[DXCCS14],[DXCCS15],[ECODE1],[ECODE2]
      ,[ECODE3],[ECODE4],[E_CCS1],[E_CCS2],[E_CCS3],[E_CCS4],[ELECTIVE],[FEMALE],[HOSPID],[HOSPST],[LOS],[LOS_X]
      ,[MDC],[MDNUM1_R],[MDNUM2_R],[NDX],[NECODE],[NEOMAT],[NIS_STRATUM],[NPR],[PAY1],[PAY1_X],[PAY2]
      ,[PAY2_X],[PL_UR_CAT4],[PR1],[PR2],[PR3],[PR4],[PR5],[PR6],[PR7],[PR8],[PR9],[PR10],[PR11],[PR12],[PR13]
      ,[PR14],[PR15],[PRCCS1],[PRCCS2],[PRCCS3],[PRCCS4],[PRCCS5],[PRCCS6],[PRCCS7],[PRCCS8],[PRCCS9],[PRCCS10]
      ,[PRCCS11],[PRCCS12],[PRCCS13],[PRCCS14],[PRCCS15],[PRDAY1],[PRDAY2],[PRDAY3],[PRDAY4],[PRDAY5],[PRDAY6]
      ,[PRDAY7],[PRDAY8],[PRDAY9],[PRDAY10],[PRDAY11],[PRDAY12],[PRDAY13],[PRDAY14],[PRDAY15],[RACE],[TOTCHG]
      ,[TOTCHG_X],[YEAR],[ZIPInc_Qrtl]
FROM dbo.[2005_Nis]
WHERE ‘042’ IN (DX1,DX2,DX3,DX4,DX5,DX6,DX7,DX8,DX9,DX10,DX11,DX12,DX13,DX14,DX15)

INSERT INTO [dbo].[Icd9_042]
SELECT
[ID],[KEY],[AGE],[AGEDAY],[AMONTH],[ASOURCE],[ASOURCEUB92],[ASOURCE_X],[ATYPE],[AWEEKEND],[DIED],[DISCWT]
      ,[DISPUB92],[DISPUNIFORM],[DQTR],[DRG],[DRGVER],[DSHOSPID],[DX1],[DX2],[DX3],[DX4],[DX5],[DX6],[DX7]
      ,[DX8],[DX9],[DX10],[DX11],[DX12],[DX13],[DX14],[DX15],[DXCCS1],[DXCCS2],[DXCCS3],[DXCCS4],[DXCCS5],[DXCCS6]
      ,[DXCCS7],[DXCCS8],[DXCCS9],[DXCCS10],[DXCCS11],[DXCCS12],[DXCCS13],[DXCCS14],[DXCCS15],[ECODE1],[ECODE2]
      ,[ECODE3],[ECODE4],[E_CCS1],[E_CCS2],[E_CCS3],[E_CCS4],[ELECTIVE],[FEMALE],[HOSPID],[HOSPST],[LOS],[LOS_X]
      ,[MDC],[MDNUM1_R],[MDNUM2_R],[NDX],[NECODE],[NEOMAT],[NIS_STRATUM],[NPR],[PAY1],[PAY1_X],[PAY2]
      ,[PAY2_X],[PL_UR_CAT4],[PR1],[PR2],[PR3],[PR4],[PR5],[PR6],[PR7],[PR8],[PR9],[PR10],[PR11],[PR12],[PR13]
      ,[PR14],[PR15],[PRCCS1],[PRCCS2],[PRCCS3],[PRCCS4],[PRCCS5],[PRCCS6],[PRCCS7],[PRCCS8],[PRCCS9],[PRCCS10]
      ,[PRCCS11],[PRCCS12],[PRCCS13],[PRCCS14],[PRCCS15],[PRDAY1],[PRDAY2],[PRDAY3],[PRDAY4],[PRDAY5],[PRDAY6]
      ,[PRDAY7],[PRDAY8],[PRDAY9],[PRDAY10],[PRDAY11],[PRDAY12],[PRDAY13],[PRDAY14],[PRDAY15],[RACE],[TOTCHG]
      ,[TOTCHG_X],[YEAR],[ZIPInc_Qrtl]
FROM dbo.[2006_Icd9]
WHERE ‘042’ IN (DX1,DX2,DX3,DX4,DX5,DX6,DX7,DX8,DX9,DX10,DX11,DX12,DX13,DX14,DX15)

Alter Table Statements to add Dimension table keys
ALTER TABLE Icd9_042
ADD AdmissionMonthKey int

ALTER TABLE Icd9_042
ADD PrimaryPaySourceKey int

ALTER TABLE Icd9_042
ADD SecondaryPaySourceKey int

ALTER TABLE Icd9_042
ADD AgeYearDayKey int

ALTER TABLE Icd9_042
ADD YearKey int

ALTER TABLE Icd9_042
ADD HospitalStateKey int

ALTER TABLE Icd9_042
ADD AdmissionSourceKey int

ALTER TABLE Icd9_042
ADD RaceCodeKey int

ALTER TABLE Icd9_042
ADD GenderCodeKey int

Add Dimension table keys to Staging Table
—UPDATE Icd9_042
—SET AdmissionMonthKey = a.AdmissionMonthKey
—FROM DimAdmissionMonths a
—WHERE a.AdmissionMonthID = AMONTH

—UPDATE Icd9_042
—SET HospitalStateKey = a.HospitalStateKey
—FROM DimHospitalStates a
—WHERE a.HospStateAbrev = Icd9_042.HOSPST

—UPDATE Icd9_042
—SET AgeYearDayKey = a.AgeYearDayKey
—FROM DimAgeYearDays a
—WHERE 
(a.AgeYear = Icd9_042.AGE AND Icd9_042.AGE > 0)
OR (Icd9_042.AGEDAY > 0 AND Icd9_042.AGEDAY = a.AGEDAY)

—UPDATE Icd9_042
—SET AgeYearDayKey = 1
—WHERE 
AGE <= 0 AND AGEDAY = -99

—UPDATE Icd9_042
—SET PrimaryPaySourceKey = a.PaySourceKey
—FROM DimPaySources a
—WHERE PAY1 = a.PaySourceID

—UPDATE Icd9_042
—SET SecondaryPaySourceKey = a.PaySourceKey
—FROM DimPaySources a
—WHERE PAY2 = a.PaySourceID

—UPDATE Icd9_042
—SET AdmissionSourceKey = a.AdmissionSourceKey
—FROM DimAdmissionSources a
—WHERE ASOURCE = a.ASourceID

—UPDATE Icd9_042
—SET RaceCodeKey = a.RaceCodeKey
—FROM DimRaceCodes a
—WHERE RACE = a.RaceID

—UPDATE Icd9_042
—SET GenderCodeKey = a.GenderCodeKey
—FROM DimGenderCodes a
—WHERE FEMALE = a.GenderCodeID

—UPDATE Icd9_042
—SET YearKey = a.YearKey
—FROM DimYears a
—WHERE [YEAR] = a.YearNumber

END
GO

Hi I’m trying to append the result of my query to another table, but i get the an error, here is my code for the project

--create new table
create table tempweblogs
(
  date1 datetime
  users nvarchar(50)
  utotal int
  date2 datetime
  hostname nvarchar(50)
  htotal int
  date3 datetime
  srcip nvarchar(50)
  stotal int
)
--insert query result to tempweblogs table

insert into tempweblogs 
SELECT distinct top 10 
       Xdate as date1, Xuser as users, count (Xuser) as utotal 
from   weblogs 
where Xdate='2/16/2016'  and Xuser is not null 
group by Xuser, Xdate order by utotal  DESC    

SELECT distinct top 10 
       Xdate as date2, Xhostname as hostname, count(Xhostname) as htotal
from weblogs    
where Xdate='2/16/2016'  and xhostname is not null 
group by Xhostname, Xdate order by htotal DESC

SELECT distinct top 10 
       Xdate as date3, Xsrcip as srcip, count (Xsrcip) as stotal 
from weblogs 
where Xdate='2/16/2016'  and Xuser is not null 
group by Xsrcip, Xdate order by stotal  DESC

Squirrel's user avatar

Squirrel

22.9k4 gold badges37 silver badges32 bronze badges

asked Jun 30, 2016 at 3:09

Melvuen's user avatar

1

You should need to specify the column list in the INSERT statement

insert into tempweblogs ( date1 , users , utotal )
select ....

also you need the INSERT clause for all 3 query

answered Jun 30, 2016 at 3:13

Squirrel's user avatar

SquirrelSquirrel

22.9k4 gold badges37 silver badges32 bronze badges

0

Hi I’m trying to append the result of my query to another table, but i get the an error, here is my code for the project

--create new table
create table tempweblogs
(
  date1 datetime
  users nvarchar(50)
  utotal int
  date2 datetime
  hostname nvarchar(50)
  htotal int
  date3 datetime
  srcip nvarchar(50)
  stotal int
)
--insert query result to tempweblogs table

insert into tempweblogs 
SELECT distinct top 10 
       Xdate as date1, Xuser as users, count (Xuser) as utotal 
from   weblogs 
where Xdate='2/16/2016'  and Xuser is not null 
group by Xuser, Xdate order by utotal  DESC    

SELECT distinct top 10 
       Xdate as date2, Xhostname as hostname, count(Xhostname) as htotal
from weblogs    
where Xdate='2/16/2016'  and xhostname is not null 
group by Xhostname, Xdate order by htotal DESC

SELECT distinct top 10 
       Xdate as date3, Xsrcip as srcip, count (Xsrcip) as stotal 
from weblogs 
where Xdate='2/16/2016'  and Xuser is not null 
group by Xsrcip, Xdate order by stotal  DESC

Squirrel's user avatar

Squirrel

22.9k4 gold badges37 silver badges32 bronze badges

asked Jun 30, 2016 at 3:09

Melvuen's user avatar

1

You should need to specify the column list in the INSERT statement

insert into tempweblogs ( date1 , users , utotal )
select ....

also you need the INSERT clause for all 3 query

answered Jun 30, 2016 at 3:13

Squirrel's user avatar

SquirrelSquirrel

22.9k4 gold badges37 silver badges32 bronze badges

0

Ebobla

0 / 0 / 0

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

Сообщений: 2

1

18.06.2020, 16:52. Показов 3994. Ответов 4

Метки sql, sql query, sql server (Все метки)


Здравствуйте

Нужна помощь, не могу понять, в чем допущена ошибка
Пытаюсь создать таблицу, в итоге появляется ошибка

Сообщение 213, уровень 16, состояние 1, строка 14 Имя столбца или число предоставленных значений не соответствует определению таблицы

T-SQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use Beauty
create table Client
(
ID decimal(9,0) Primary Key IDENTITY(1,1),
NAME nvarchar(50) Not Null,
Male_female nvarchar(50) Not Null,
Age date Null,
Street nvarchar(50) Null,
House nvarchar(50) Null,
Apartment nvarchar(50) Null,
Phone nvarchar(50) Null,
E_mail nvarchar(50) Null,
Note nvarchar(max) Null
)
alter table Client
add Discount decimal(3,0) Null
 
EXEC sp_help Client
 
INSERT Client VALUES ('Терехова Светлана Юрьевна', 1985-10-14, 'Лизюкова', '134', '78', '+7(905)-456-78-43',
'terehovaS@yandex.ru', 5)
INSERT Client VALUES ('Иванова Оксана Васильевна', 1989-06-08, 'Никитина', '17','8', '+7(950)-189-23-01', 'ivanovaO@yandex.ru', 0)
INSERT Client VALUES ('Потапова Евгения Петровна', 1981-01-04, 'Морозова', '12', '3', '+7(908)-689-98-09',
'potapovaE@yandex.ru',5)

Не могу понять в чем проблема.

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Programming

Эксперт

94731 / 64177 / 26122

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

Сообщений: 116,782

18.06.2020, 16:52

Ответы с готовыми решениями:

Сообщение 156, уровень 15, состояние 1, строка 11
Declare @y float
declare @a float
declare @al float
declare @x float
declare @b float
Set @a=4…

Сообщение 547, уровень 16, состояние 0, строка 2
&quot;Когда заношу данные в таблицу выдает ошибку:
&quot;Конфликт инструкции INSERT с ограничением FOREIGN…

Сообщение 102, уровень 15, состояние 1, процедура Oborud2, строка 5
CREATE PROCEDURE Oborud2 @citrus AS INT AS
Select Oborudovanie.Тип_оборудования
from (Documenti…

Сообщение 102, уровень 15, состояние 1, строка 7 Неправильный синтаксис около конструкции «id_format»
USE master;
GO
CREATE DATABASE CD
ON
PRIMARY
(
NAME = CD_disc,
FILENAME =…

4

4736 / 3941 / 997

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

Сообщений: 25,282

Записей в блоге: 3

19.06.2020, 08:48

2

количество данных в запросе INSERT не соответствует количеству колонок в таблице



0



1561 / 1113 / 164

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

Сообщений: 6,388

19.06.2020, 08:54

3

https://docs.microsoft.com/en-… rver-ver15

(column_list)
Is a list of one or more columns in which to insert data. column_list must be enclosed in parentheses and delimited by commas.

If a column is not in column_list, the Database Engine must be able to provide a value based on the definition of the column; otherwise, the row cannot be loaded. The Database Engine automatically provides a value for the column if the column:

Has an IDENTITY property. The next incremental identity value is used.

Has a default. The default value for the column is used.

Has a timestamp data type. The current timestamp value is used.

Is nullable. A null value is used.

Is a computed column. The calculated value is used.

column_list must be used when explicit values are inserted into an identity column, and the SET IDENTITY_INSERT option must be ON for the table.



0



qwertehok

4736 / 3941 / 997

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

Сообщений: 25,282

Записей в блоге: 3

19.06.2020, 09:15

4

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

количество данных в запросе INSERT не соответствует количеству колонок в таблице

даже не так

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

T-SQL
1
insert TABLE (a,b,c) select a,b,c



0



2656 / 1591 / 850

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

Сообщений: 5,494

20.06.2020, 20:18

5

+ формат даты должен быть заключен в одинарные кавычки



0



IT_Exp

Эксперт

87844 / 49110 / 22898

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

Сообщений: 92,604

20.06.2020, 20:18

Помогаю со студенческими работами здесь

Сообщение 102, уровень 15, состояние 1, строка 1 Неправильный синтаксис около конструкции «DATETIME». Сообщени
CREATE TABLE Komanda (ID INT PRIMARY KEY, ФИО CHAR(100),Data obrazovania DATETIME, Nazvanie komandi…

Сообщение 213, уровень 16, состояние 1, строка 14
Здравствуйте

Нужна помощь, не могу понять, в чем допущена ошибка
Пытаюсь создать таблицу, в…

Что такое &lr=213
Наверняка уже обсуждалось, но в поиске не ищется. Когда проверяешь домен на проиндексированность в…

toshina satellite A300D-213
После падения у данного ноута разбилась матрица (модель LP154WX4 (TL) (C3)) и погнулся разъем USB….

Как сделать чтобы уровень змейки и уровень яблока совпадал?
Здравствуйте.
Как сделать чтобы уровень змейки и уровень яблока совпадал?

Работа со звуком более или менее низкий уровень. Получить уровень сигнала микрофона
Доброго дня или ночи.
Вобщем товарищи дело такое. предо мной стоит задача определять уровень шума…

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:

5

  • Remove From My Forums
  • Question

  • I attempted to upgrade MS SQL 2008 R2 SP1 to SP3. the upgrade setup.exe apparently succeeded but the instance refuses to start. Following are the  relevant messages in the <g class=»gr_ gr_329 gr-alert gr_spell gr_run_anim ContextualSpelling
    ins-del multiReplace» data-gr-id=»329″ id=»329″>errorlog</g>. Is there a way to fix this without actually building the master ? Thanks

    09-21 11:46:43.77 Logon       Error: 18401, Severity: 14, State: 1.
    2016-09-21 11:46:43.77 Logon       Login failed for user ‘NT AUTHORITYNETWORK SERVICE’. Reason: Server is in script upgrade mode. Only administrator can connect at this time. [CLIENT: <local machine>]
    2016-09-21 11:46:44.34 spid7s      Database ‘master’ is upgrading script ‘repl_master.sql’ from level 171051460 to level 171054960.
    2016-09-21 11:46:44.37 spid7s      Configuration option ‘allow updates’ changed from 1 to 1. Run the RECONFIGURE statement to install.
    2016-09-21 11:46:44.37 spid7s      Configuration option ‘allow updates’ changed from 1 to 1. Run the RECONFIGURE statement to install.
    2016-09-21 11:46:44.37 spid7s      FILESTREAM: effective level = 0, configured level = 0, file system access share name = ‘MSSQLSERVER’.
    2016-09-21 11:46:44.39 spid7s      Error: 213, Severity: 16, State: 1.
    2016-09-21 11:46:44.39 spid7s      Column name or number of supplied values does not match table definition.
    2016-09-21 11:46:44.39 spid7s      Error: 912, Severity: 21, State: 2.
    2016-09-21 11:46:44.39 spid7s      Script level upgrade for database ‘master’ failed because upgrade step ‘repl_master.sql’ encountered error 213, state 1, severity 25. This is a serious error condition which might interfere with regular operation
    and the database will be taken offline. If the error happened during upgrade of the ‘master’ database, it will prevent the entire SQL Server instance from starting. Examine the previous <g class=»gr_ gr_233 gr-alert gr_spell gr_run_anim ContextualSpelling
    ins-del multiReplace gr-progress» data-gr-id=»233″ id=»233″>errorlog</g> entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.
    2016-09-21 11:46:44.39 spid7s      Error: 3417, Severity: 21, State: 3.
    2016-09-21 11:46:44.39 spid7s      Cannot recover the master database. SQL Server is unable to run. Restore master from a full backup, repair <g class=»gr_ gr_238 gr-alert gr_gramm gr_run_anim Punctuation only-del replaceWithoutSep»
    data-gr-id=»238″ id=»238″>it,</g> or rebuild it. For more information about how to rebuild the master database, see SQL Server Books Online.
    2016-09-21 11:

Понравилась статья? Поделить с друзьями:
  • Ошибка 2122 гранта 8 клапанная
  • Ошибка 217 r keeper ошибка фискальной печати как исправить
  • Ошибка 2127 уаз патриот причина
  • Ошибка 2122 ваз 2114
  • Ошибка 217 r keeper не получается напечатать чек