SQL Server 2019 Express – can create table but unable to insert records

I am fairly new to SQL Server. It seems I have installed 2019 Express and SSMS correctly.

Using SSMS, I have created a user and schema by the same name, and made this the default schema for this user (who is the owner).

I can connect to the server using ODBC, and successfully create a simple table using:

''' CREATE TABLE Jobs ( RowID integer primary key, JobCode Char(7) not null default ' ', ClientCode Char(10) not null default ' ', JobName Char(70) not null default ' ', AddrRowID Integer default 0 ) '''

The program then successfully sends the following command (again via ODBC):

''' grant alter, select, update, insert, delete on Jobs to UserID '''

However, the server returns an error, when the program sends the following command (via ODBC):

''' INSERT INTO Jobs ( JobCode, ClientCode, JobName ) VALUES ( ' A2', 'ADDRE50000', 'Client data entry (new records & editing)' ); '''

I've spent many hours trying various things, but can't figure out what is wrong. Any ideas?

Thanks, G



Read more here: https://stackoverflow.com/questions/64401034/sql-server-2019-express-can-create-table-but-unable-to-insert-records

Content Attribution

This content was originally published by Graeme at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: