Skip to content

How to define self-defined log in SQL Server

I am now dealing with a huge table that contains XML each row. My job is to write sp to parse the XML and insert its data to the other corresponding tables row by row. But there is a problem that when the sp interrupts, partial data is inserted into the new table while the others are not. So, I

Select text from inside a string after a keyword

I have a column in SQL Server that has a string that looks like this. I’m trying to get the value of the “some_id” which in this case would ‘12345678911’. Any help on how I could get just …

Create pivot table in Postgres 9.6

I am having trouble creating the desired output using SQL. I have an events table, that holds a record for every event taken by each candidate, as so: | id | asmnt | timestamp | score | |–…

Combine / Join SQL queries

I have a query which gets data from a JSON document, checks which values have been returned and then returns that count. As part of this query, I’d like to also return cat_name, dog_name and add a WHERE pet_store = ‘london’ I’m not sure exactly where I’m suppose to add the other …

Count number of values in SQL query / bigquery

I have a query which extracts some data from a JSON document and I have a query that based on the number of values returned displays an overall column count. I can’t seem to work out how to combine these into a single query? assume that I need to use a sub-query but not sure where to go from here?

Trying to do basic subtraction from a database table

I’m trying to subtract data based on user input, for example: UPDATE table SET quantity=quantity – * some input value* This is easy if I’m subtracting field by field, where id=1…2…3, but I want to subtract values automatically when I input quantity, so if input is 60, and there i…