I’m having following XML and query. header tags are there and Item tag can be repeated up to 10 tags. I want to insert those item no and qty in separate columns. Here I mentioned only 2 tags for Item but in real situation there are 5 tags in XML. So in worst case scenario it will be 50 columns.
Tag: sql
Select average entries per day into table
Ok I have looked at multiple entries in stackoverflow for this but cant seem to quite work them for me. I have a table called email_Archive It contains every email sent by every user. Columns in Db are: Challenge: I am trying to get the average amount of emails sent by a select list of users per day for the
HANA: How to add a unique contraint on a column that is already indexed?
Having the following schema: I am trying to a unique contraint to the column. But this runs into an error: I can understand that the column is already indexed because I have created the index by myself. But I want the column to be unique. Is there a way to do this? Answer This is indeed an undocumented limita…
Divide by zero exception in SQL Server
I have an update statement which has division operation and one row throws exception Divide by zero exception and I see that none of the rows got updated . How to continue on exception so that rows which doesn’t encounter 0 gets updated and row which has 0 fails? Its just a normal update statement witho…
Count(*) of two sql statements where results are subset of another one
I have a table which has ~500 GBs of data and have two queries running on it. I feel Query 2 execution on whole table is un-necessary as the results are subset of Query 1. Is there any optimized way to first execute Query 1 then run Query 2 on the results of it and finally return Count of both
Unable to Run Update Query in SQL Azure *Invalid object name ‘DataSync.provision_marker_dss’.*
I was syncing my Azure SQL Database with On-Premises SQL Database which created a lot of tables in the Online database (As Usual). Anyway, It was working fine. Now, I had to re-create the Azure SQL Database. So, I deleted the Sync Group & Sync Agent as well. Everything’s working absolutely fine unle…
Getting the data from SQL and inserting it inside the Java Textfield
I’ve been trying to get the data from the SQL and insert it inside the JTextfield. This code is in the button action, but when I clicked the button, there is nothing happening. Answer I redo my JFrame and rewrite this code. There is no problem with this code. I think it just override because I copied th…
None-unique column index error using cur.fetch_pandas_all() to extract data from Snowflake
I’m pulling results from Snowflake using the code below. The SQL statement returns fine in Snowflake Web UI but when pulled in Python I get a ValueError: Found non-unique column index If this happened in my Pandas workflow, I would reset_index() but, as its happening at the point of the dataframe being …
Deleting record outputs else statement of else 3 times after deleting record in PHP and SQL
I am trying to delete a record in php mysql but my code jumps me to the else statement where I have “record not deleted” message printed out. Strangely it prints out 3 times. I am attempting to have it simply show an alert when the record is deleted to keep things simple. I know I am connected to …
SQL – get an AVG from a COUNT
how you doing? I’m trying to get the average from a count. The metric is a string, so I get an error. I’ve tried some ways, but I can’t. Thanks for your help This is the code This is what I’ve unsuccessfully tried AVG (newsletter) as percentage AVG (CAST (newsletter as INT64)) as perce…