devxlogo

Problem Using Execute SQL in Microsoft Query

Problem Using Execute SQL in Microsoft Query

Question:
In Microsoft Query I can’t seem to use the Execute SQL function. I’m learning SQL from a book called The ColdFusion 4.0 Web Application Construction Kit (Macmillan, 1998). The book has an example that goes like this:

  1. Open Execute SQL in Microsoft Query.
  2. Specify Data source.
  3. Type:
      INSERT INTO Departments(Department)  VALUES ('Administration')

Each time I try to do this I get an error message that says, “This operation must use an updateable query”. I am not really sure what that means and I can’t find any help files to explain it to me.

Please help!

Answer:
I must admit I find it mystifying myself but I will hazard a guess that what makes a query updateable is the presence of a primary key column, a way to distinguish one row from another.

In your example you provide only “Administration” as a value. I wonder what would happen if the Departments table also had a field called “ID”? If so, I bet changing your statement to read something like this will fix it:

INSERT INTO Departments(Department, ID)VALUES ('Administration', 4) would do it.

Mind the data type of ID. As you can see, I have assumed INT and that there is no other ID of 4 in the column, but it could be almost anything.

See also  What Are International Payments, And How Do They Work?
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist