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.

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