I Can't Remove NOT NULL (Reqired) Constraint Using SQL (1 Viewer)

ADIGA88

Member
Local time
Today, 23:00
Joined
Apr 5, 2020
Messages
94
Hi Guys,

I am trying to remove the required property from a field using SQL, but can't find anything on MS Docs, another site suggests using the ALTER Column but I can't seem to make it work.
I tried:
Code:
ALTER TABLE tblVendorsInvoicesOracle ALTER COLUMN strPONo TEXT(20) Null
Required Still True
1655562863649.png

Anyone has an idea how to make work.
Thanks
 

June7

AWF VIP
Local time
Today, 12:00
Joined
Mar 9, 2014
Messages
5,473
This is a linked Oracle table?
I don't think can do this with linked table, only local table. Maybe a pass-through query could act on the backend table.

However, with Access tables, some properties cannot be altered with SQL - Required appears to be one that cannot https://stackoverflow.com/questions...e-the-required-property-of-a-column-in-access. Perhaps that is the case with Oracle.

Could you provide link to that other site?
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:00
Joined
May 7, 2009
Messages
19,245
If you cant do it in sql, do it in design.
Add another field same type as your PO, same length and set the Required to No.
Copy the po to this new field using update query.
Delete the old PO field and rename the new one.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:00
Joined
Feb 19, 2002
Messages
43,280
Any reason you are trying to do this with DDL rather than through the interface? The alternative methods are pretty awkward if you need to automate this.
 

ADIGA88

Member
Local time
Today, 23:00
Joined
Apr 5, 2020
Messages
94
Any reason you are trying to do this with DDL rather than through the interface? The alternative methods are pretty awkward if you need to automate this.
Because the DB is on a server using Access RunTime, any update to the DB I am trying to use SQL and DAO when I can (I do not copy the DB to another PC to not interrupt the users).
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:00
Joined
Feb 19, 2002
Messages
43,280
It is 100% wrong to update table design in the BE while the users might be trying to update data. This is a very bad plan. Do your BE maintenance off hours no matter how inconvenient it is for you.
 

ADIGA88

Member
Local time
Today, 23:00
Joined
Apr 5, 2020
Messages
94
PS. Actually, also I found it neater to deploy changes this way because I am making a lot of changes in the test environment DB and it's easier to run the script than remembering what I changed when deploying.
 

ADIGA88

Member
Local time
Today, 23:00
Joined
Apr 5, 2020
Messages
94
It is 100% wrong to update table design in the BE while the users might be trying to update data. This is a very bad plan. Do your BE maintenance off hours no matter how inconvenient it is for you.

actually, I am kicking the user out when running the script as a safety precaution (it's not a big deal to stop users for 30 sec but manually it takes more than an hour to update).
but for the sake of the argument, I am deploying the changes in one big transaction. should this lock all that tables while the script is running?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:00
Joined
Feb 19, 2002
Messages
43,280
I told you it was a bad idea. Take your chances if you want. You ALWAYS back up the database before and after changes. I find it hard to believe that you can't actually plan structural updates and need to do them on the fly.
 

GPGeorge

Grover Park George
Local time
Today, 13:00
Joined
Nov 25, 2004
Messages
1,873
Do you not have two versions of this relational database application? One for production and one for Development? If not, create yourself a development environment now, before running into any further difficulties with live production that run the risk of taking down the entire production relational database application in real-time. Make your changes in the development version. Test and validate your changes in the development version. Wait until off-work hours and update the production environment after making a back up and before users return to work. Then you can safely implement the changes on the production database. When users return to work, they can pick up on the new production version without being interrupted and with much lower possibility that something you did--deliberately or inadvertently--broke the system.

Also, make sure your employer knows and approves of your strategy for implementing improvements in a logical manner.
 
Last edited:

Users who are viewing this thread

Top Bottom