---
title: "New table displaying as readonly"
canonical: "https://servicedesk.maxgeo.com/space/DS/1258979330/New%20table%20displaying%20as%20readonly"
format: markdown
---
|  |  |  |  |
| --- | --- | --- | --- |
| Application: | DataShed5 | Related Build Number: | 3.0.1 |
| Status: | [Known Issue] | Resolved Build Number | 3.0.1 |
|  |  |  |  |

---

**Issue:**

Table is read only in DataShed5 when logged in as a SysAdmin or UserPlus


![image-20240508-052925.png](media://7b85085c-8d68-4bc5-af4a-062d939011bd)

Example table:

```sql
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[tblTestReadOnlyTable](
	[Data_Set] [nvarchar](50) NULL,
	[Hole_ID] [nvarchar](50) NULL,
	[Comment] [nvarchar](50) NULL,
	[Notes] [nvarchar](50) NULL
) ON [PRIMARY]
GO
```

**Causes:**

There are multiple causes. It can be either just one listed or combinations of the ones listed.

1. Tabled flagged as Read Only when registered
2. Insufficient permissions against the table in SQL
3. Table has no primary keys


**Resolution: ** 

1. Uncheck the Read Only flag against the table in the admin portal.

![image-20240508-051513.png](media://83f8544b-3a65-4c69-b573-a1e706852b25)

2. Update Permissions so that DataShed can access the table correctly

```sql
GRANT DELETE ON [dbo].[tblTestReadOnlyTable] TO [DS_SysAdmin]
GRANT INSERT ON [dbo].[tblTestReadOnlyTable] TO [DS_SysAdmin]
GRANT SELECT ON [dbo].[tblTestReadOnlyTable] TO [DS_SysAdmin]
GRANT UPDATE ON [dbo].[tblTestReadOnlyTable] TO [DS_SysAdmin]
GRANT SELECT ON [dbo].[tblTestReadOnlyTable] TO [DS_User]
GRANT INSERT ON [dbo].[tblTestReadOnlyTable] TO [DS_UserPlus]
GRANT SELECT ON [dbo].[tblTestReadOnlyTable] TO [DS_UserPlus]
```

3. Add a Primary key to the table

```sql
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[tblTestReadOnlyTable](
	[Data_Set] [nvarchar](50) NULL,
	[Hole_ID] [nvarchar](50) NULL,
	[Comment] [nvarchar](50) NULL,
	[Notes] [nvarchar](50) NULL,
CONSTRAINT [PK_tblTestReadOnlyTable_Data_Set_Hole_ID] PRIMARY KEY CLUSTERED 
(
	[Data_Set] ASC,
	[Hole_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
```



> ⚠️ DB Modification
> ⚠️ 
> ⚠️ Before any change is made to a user database (or system), maxgeo recommends competent staff should follow all standard database change management practices and never make untested changes to a production database.  
> ⚠️ Change, test and document all modifications on a test copy of your database to ensure results are as expected before implementing them on your live database. Always ensure a full backup is available in case rollback is required and follow all company change management procedures and practices.