Insert Statement Problem

Insert Statement Problem

Question:
I am facing a problem with the following SQL stored procedure:

CREATE PROCEDURE usp_CreateAdminUser   /*Input Parameters  for the Create Admin User   */   @FullName         varchar(100),   @Telephone         varchar(50),   @Email            varchar(50),   @Address1         varchar(100),   @Address2         varchar(100),   @Address3         varchar(100),   @City            varchar(50),   @CompanyName      varchar(100),   @State            varchar(50),   @PostCode         varchar(50),   @POBox         varchar(50),   @Country         varchar(50),   @LoginName         varchar(100),   @Password         varchar(100),   @ParentUserID         numeric(9),   @EuivalantUserID      numeric(9),   @AdminID         numeric(9)   OUTPUT         /*Output Parameter - Auto incremented Admin ID*/AS   INSERT INTO AdminUser       (      [FullName],      [Telephone],      [Email],      [Address 1],      [Address 2],      [Address 3],      [City],      [Company Name],      [State],      [Post Code].      [POBox],      [Country],      [LoginName],      [Password],      [Parent User ID],      [Equivalant User ID]      )    VALUES      (      @FullName,      @Telephone,      @Email,      @Address1,      @Address2,      @Address3,      @City,      @CompanyName,      @State,      @PostCode,      @POBox,      @Country,      @LoginName,      @Password,      @ParentUserId,      @EuivalantUserID      )

This is the error I get:

There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.

My table structure is in MS SQL 7:

if exists (select * from sysobjects where    id = object_id(N'[dbo].[AdminUsers]')    and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[AdminUsers]GOCREATE TABLE [dbo].[AdminUsers] (   [AdminID] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,   [FullName] [varchar] (100) NOT NULL ,   [Telephone] [varchar] (50) NULL ,   [Email] [varchar] (50) NOT NULL ,   [Address 1] [varchar] (100) NULL ,   [Address 2] [varchar] (50) NULL ,   [Address 3] [varchar] (50) NULL ,   [City] [varchar] (50) NOT NULL ,   [Compnay Name] [varchar] (100) NOT NULL ,   [State] [varchar] (50) NULL ,   [Post Code] [varchar] (50) NULL ,   [POBOX] [varchar] (50) NULL ,   [Country] [varchar] (50) NOT NULL ,   [LoginName] [varchar] (100) NOT NULL ,   [Password] [varchar] (100) NOT NULL ,   [Parent User ID] [numeric](18, 0) NULL ,   [Equivalant User ID] [numeric](18, 0) NULL ,   [Status] [int] NULL ) ON [PRIMARY]GO

Answer:
The problem seems to be a period instead of a comma in your query values list right after the [Post Code] column. If you change this:

[Post Code].

to this:

[Post Code],

it’ll work fine.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes