Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 676259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:54:29+00:00 2026-05-14T00:54:29+00:00

I wish to DELETE the data from a table before performing an INSERT INTO,

  • 0

I wish to DELETE the data from a table before performing an INSERT INTO, however I keep recieving an error stating:

Insert Error: Column name or number of supplied values does not match table definition.

I’ve also tried defining the columns the data should be entered into as part of the INSERT INTO statement, but then get issues with column names, even though they are correct. I have a feeling the issues relates to me selecting 2 PostCode entries and converting them into 1, but if someone could shed light on this it would be a big help.

My code can be found below, if you want me to add the code where I was sepcifing column names let me know. So you know the fields selected are all the fields in the Course table other than AutoNum which is a auto number primary key and SSMA_TimeStamp, which is a TimeStamp.

BEGIN

DELETE dbo.Course

INSERT INTO dbo.Course

SELECT 
    RTRIM( CAST (sd.[RefNo] AS nvarchar(50))) AS 'Student Ref No',
    sd.[FirstForeName] AS Forename,
    sd.[Surname],
    sd.[Address1],
    sd.[Address2],
    sd.[Address3],
    sd.[Address4],
    sd.[DateOfBirth] AS DOB,
    sd.[PostCodeOut] + ' ' + sd.[PostCodeIn] AS 'Post Code',
    o.[Name] AS 'Course Name',
    o.[Code] As 'Course Code',
    e.[StartDate] AS 'Start Date',
    e.[ExpectedGLH] AS 'Exp GLH',
    e.[ExpectedEndDate] AS 'Expected End Date',
    e.[ActualEndDate] AS 'Actual End Date',
    e.[Grade] AS 'Grade',
    ou.[Description] AS Outcome,
    cs.[Description] AS 'Completion Status',
    sd.[Tel1] AS 'Tel 1'

  FROM [xxxxxxx].[xxxxxx].[dbo].[StudentDetail] sd
  INNER JOIN [xxxxxxx].[xxxxxx].[dbo].[Enrolment] e
  ON sd.[StudentDetailID] = e.[StudentDetailID]
  Inner JOIN [xxxxxxx].[xxxxxx].[dbo].[Offering] o
  ON o.[OfferingID] = e.[OfferingID]
  INNER JOIN [xxxxxxx].[xxxxxx].[dbo].[CompletionStatus] cs
  ON cs.[CompletionStatusID] = e.[CompletionStatusID]
  INNER JOIN [xxxxxxx].[xxxxxx].[dbo].[Outcome] ou
  ON ou.[OutcomeID] = e.[OutcomeID]
  WHERE sd.[AcademicYearID] = '09/10'
  AND
  o.[Code]  LIKE '%-ee%'
  AND
  o.[Name]  LIKE '%-%dl%'
  ORDER BY
  sd.[RefNo]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:54:30+00:00Added an answer on May 14, 2026 at 12:54 am

    It sounds like your ‘Course’ table does not match your insert statement, either in the number or names of the columns specified (as per the error message).

    Could you add the create table code for the ‘Course’ table as that will show where the discrepancy lies.

    Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

c.execute(DELETE FROM data WHERE user = %s AND machine = %s , (user, machine))
I have a database with 2 tables I wish to pull data from both
I know how to insert a new row into a table that has a
I have a situation, I wish to have 3 word in 1 table data.
I wish fetch data in a XML file, where Tag is a variable.. My
I wish I could figure this out. I need to produce a table with
is this possible with apache http server? i wish to delete a local xml
I have a JSON file with a lot of unneeded data and I wish
I have a column which I believe has been declared wrongly. It contains data
I wish for a class A to contain some data, and class B will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.