Hi,

I am having problems with deleting part of a record. The record has approximately 15 different fields, and I only wish to delete 3 of them using the following piece of SQL coding:

DELETE [PMID 1], [PMName 1], [Price 1] FROM Subscriptions WHERE [Customer ID]="001"

The code works absolutely fine, but it just doesn't do what I want it to. Instead of deleting those 3 fields, it deletes the entire row, which isn't very helpful.

Any ideas on how to solve this problem?

Thanks in advance :)

The SQL statement "DELETE" is used to remove an entire row. It appears what you want is to set values in specific columns of an existing row to NULL. You do this with an UPDATE statement. Try this:

UPDATE Subscriptions
set [PMID 1] = NULL, [PMName 1] = NULL, [Price 1] = NULL
where [Customer ID] = "001"

You just have to make sure that the columns allow for NULL (as in "Allow Zero Length" set to Yes in the table definition.

Hope this helps! Good luck!

Worked perfectly, thanks a lot :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.