I have a table DOMAINS in 2 different schemas with columns ID, NAME,CODE,DESCRIPTION. For any NAME exist in new schema, it should use existing ID without any merge; for those new NAME records, it should insert with ID from old schema. How can i intepret the portion of do nothing in above query? Answer For you…
Saving a pem certificate in a SQL Server database
I need to save the content of a *.PEM certificate in a SQL Server database. I plan to save it in a nvarchar() column, but I’m not sure what length should I use. I would appreciate any advice. If you have experience with saving pem files to a relational database that would be even better. Answer There is…
Time difference under 1h for group of records
Table looks like this Play_name Status Date 1 Romeo & juliet Start 23.01.2018 16:30:00 2 Romeo & juliet Break 23.01.2018 17:15:00 3 Romeo & juliet END 23.01….
Adding a new column with data
Below is my table: Now I want to add a new column called ‘Gender’ with values M,M,M,F in 4 rows respectively. I first added a new column using: Now I understand I can add data one by one by using: But how do I add all 4 data at once? Answer You don’t, unless there is some other piece of
How can i use Flyway migration with single schema and multiple projects
How to manage multiple projects dealing with the same DB schema. The Flyway migration scripts in each of the project does not allow to start if it is modified by the other project. For example: I have a spring boot Project X with a FlywayInitializer class. And i have a submodule Project Y with also his own Fl…
MySQL script triggers Error #1241
I have the script below, which is supposed to get a price for an array of ID’s that has been provided. But it needs to get 1 price per ID, and the tricky part is, that I want to have the ability to have scheduled price updates. This mean that it needs to take the price that is <= UTC_TIMESTAMP
Avoid duplicates in postgreSQL
I’m using postgreSQL version 10.3 and I have a table like this: I want to make numerous INSERT and make sure there are no duplicates. So I thought about using INSERT INTO … ON CONFLICT DO NOTHING;. The idea is to insert the record only if the values on the columns first | second | third | fourth |…
LINQ Room id where user exists
I have two tables: ChatRoom Id (int) ChatUser (where i insert the users to the chat room, 1 row per user) RoomId (int) // Id from table ChatRoom UserId (int) I want to loop out all rooms where im in i do like this. But how do get the room id where the second user with the variable userId2 exists?
Mysql counting join table OneToMany
Task: id | title | description | ——————————————————————— 1 | Task1 | Descr1 | 2 | Task2 | Descr1 | 3 | Task2 | Descr1 | 4 |…
How to get the return value from EXEC(Query) inside stored procedure
Is there any way to get the return value from the following SQL script? The @ColumnValue will be 1 or 0. I am expecting single value from @ColumnValue. I want to check if the @ColumnValue is NULL or not. If Not Null, I want to update a table with this @ColumnValue. Thanks in advance Answer If you update table…