Using visual studio 2017, and a VB.net project, we use the resources.resx to execute SQL queries to update the live databases of the clients using our project (We add .txt files with queries in, and then run and update the database). The database is MS SQL2017.
I have added a query that will not run the first time I execute it (for example when I first install the program and all queries have to run), but if I go and manually update the "database version" in the project to not include the latest failed script but rather shows the previous one, it then runs fine. Meaning anyone updating to the newest version does not miss the script, but any new installations does and needs to then be run manually.
The script is simple :
SET [Admin] = 0
INSERT INTO [dbo].[ScriptVersion]
The ScriptVersion is just a table we created to make sure the scripts complete, and if for any reason it does not completely run, that version does not get written into the table.
Why would the code not run on the first attempt but run fine during a second attempt or update?
Please let me know if any more information is needed.