Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

siard --> microsoft sql: Error executing query: ALTER TABLE ... ADD FOREIGN KEY #528

Open
ibbenz opened this issue Sep 19, 2022 · 4 comments
Assignees

Comments

@ibbenz
Copy link

ibbenz commented Sep 19, 2022

Description:
A siard file is loaded with dbptk into a Microsoft SQL Database.
No error message occurs during the transfer, but in the end
only 2 out of 8 tables are transferred.
Only in the dbvtk.log the user can see, that an error occured
during an ALTER TABLE query as a part of the automatic transfer process.

Steps required to reproduce the bug:

  1. Load the siard-file in dbptk
  2. Send to Live DBMS (Choose SQL)
  3. Notice in SQL-Database that only 2 Tables were loaded.

The siard-file:
0_1-3_Northwind_simple_220913.zip

Attach the dbptk-app.log.txt file below.
dbvtk.log

@hmiguim hmiguim self-assigned this Sep 20, 2022
@hmiguim
Copy link
Member

hmiguim commented Sep 20, 2022

The database user has the correct permissions?

@ibbenz
Copy link
Author

ibbenz commented Sep 21, 2022

Meanwhile I checked the permissions of the user/login "testlogindbptk"
This was the login/user which I created for the upload siard-->microsoft sql.

In order to check, if the user has the permission to alter the tables, I did the following:

  1. I log into the Microsoft SQL Server Management Studio
    as user "testlogindbptk"
  2. I create a table with two columns which are used as primary and foreign key.
  3. I create the primary and foreign key.

I captured the process in the attached video:

Permissions_Microsoft_SQL_Studio.mp4

@hmiguim
Copy link
Member

hmiguim commented Sep 21, 2022

Hi,

Manage to find the problem:

SQL Error [8111] [S0001]: Cannot define PRIMARY KEY constraint on nullable column in table 'Customers'.

However due to the way DBPTK works it executes the prepared statements in batches making the errors not so obvious.

@ibbenz
Copy link
Author

ibbenz commented Sep 22, 2022

Thank you. I have changed accordingly key-relevant columns from _true to false. Now the tables are correctly imported from SIARD into SQL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants