SQL BigQuery call the column with multiple dots in the name - sql

I have column named something like name.subname.subsubname from database which is called database.
How can I access it? I tried [name.subname.subsubname] and [name].[subname].[subsubname] and name.subname.subsubname with ` - nothing worked.
I'm using SQL BigQuery.

You didn't add enough context to the question, but from the error in the comment I think this would work
SELECT name[SAFE_OFFSET(0)].subname.subsubname
This because the error Cannot access field adjustment on a value with type ARRAY<STRUCT<adjustment STRUCT<tax_in_cents INT64 shows that you are working with an array, and before navigating an array with ., you need to get individual elements from it - which you can do with [SAFE_OFFSET(0)] to get the first one.

Related

Select distinct not working on MS ACCESS *.mdb database

I have a really old database (created in 2002) where I need to select the unique values and copy them to another table.. unfortunately the select distinct is not working on the field.
There comes always the error that the field is too small to add the data.
As I have seen is there a restriction to the length of the fields. The column is set to long text. Do you have something like a workaround / solution how to solve it fast?
I have also tried to change the database to accdb from mdb without success.. still the same error.
Each field has 318 characters. I have like 5000 rows.
Thanks in advance!
The column is set to long text.
This is well known issue...
This should help: MS Access: "The field is too small to accept the amount of data you attempted to add" error when running a query
For further details, please see: The Memo data type is now called “Long Text”

How to have Google BigQuery properly detect header names?

I successfully created a new table using the data I uploaded onto Google Cloud Platform's Storage, but the problem is the header field names are always wrong when I use the Automatically Detect setting, and set "Header rows to skip" to be 1...I just got generic names such as "string_field_0".
I know I can manually add field names under Schema, however, that is not feasible with tables that have many fields. Is there a way to fix the header names? It doesn't seem to be a big thing though...Pandas does this automatically all the time.
Thanks!
csv file in Excel:
The problem is that you only have String types in your file. So, BigQuery can't differentiate between the header and actual valid rows. If you had say another column with something other than a String e.g. Integer, then it will detect the column names. For example:
column1,column2,column3
foo,bar,1
cat,dog,2
fizz,buzz,3
Correctly loads as this because there is something other than just Strings in the data:
So, either you need to have something other than just Strings, or you need to explicitly specify the schema yourself.
Hint: you don't have the use the UI and click a load of buttons for define the schema. You can programatically do it using the API or the gcloud CLI tool.
Since it was not mentioned here, what helped me was to add 1 to Header rows to skip. You can find it under Advanced Options:
My database came from Google Sheet and it already had integer values in some columns.
Same issue occurs with Google Sheets as well. Right, the cause is having all string data in the sheet. But the workaround is simple with Google Sheets; just adding an integer column as described here

delphi create sql select statement at runtime

I am attempting to create a sql statement in XE8 at runtime to search an oracle database based on the value in a textbox. I find multiple different ways that attempt to explain this online, but I am not understanding what it is asking.
I want to search a server based on a select statement and populate TDB components (labels only) based on the data. The furthest I have gotten is to get data populated, but the where
' ... somevalue = ' + textbox.text;
seems to have no effect.
What components do I need to make this happen? I am connected to the database, and it appears that I can get some kinda data out of it, but I can't seem to figure out how to filter the results. Obviously, I cannot create this sql statement at design time as the value of textbox.text will change depending on the user's input.
My error was in how to dynamically change what the data aware components got data as it would not always be the same. I had to manually go in and modify their datafield properties. Once I did this, my query functioned correctly.

MS Access Unspecified parameter even though all IS specified

MS Access 2010 brings an error (Enter Parameter value) when I try to perform the following very simple Union query:
SELECT
[1_Toyota_2013_mit_PFC_2].[FC-Teile-Nr]
FROM 1_Toyota_2013_mit_PFC_2
UNION
SELECT
[1_Toyota_2013_ohne_PFC_2].[FC-Teile-Nr]
FROM 1_Toyota_2013_ohne_PFC_2;
Everything is specified... I understand that having "-" in the names forces me to use brackets. I am doing that, but it still causes an error. If I simply press OK, then I do get the correct result. But I'd like to have the error not pop up.
Any idea why this happens?
Thanks!
My query was based on two sub queries. The unspecified parameter was a calculated field in one of the sub queries that I had created. After creating the field, I subsequently changed the name of one of the tables, and while Access updated all the other query fields, it did not ofcourse update my manually created calculation.
Thanks for the probing questions that led me to the answer 4dmonster!

Change the page filter on pivot tables

I may resort to using multiple pivot tables if I cannot do this but I want to give it a try anyway.
Basically, I have a sheet with a pretty good amount of rows (45k+) and I want to use a pivot table to group items together so that I can get uniques only to then match them in an Access database and add new items only. I have to do that for a few columns and so I thought that filtering the table using VBA could be a good solution though I have not been able to achieve it. From MSDN I understand that it is possible to add filters using PivotFields.Add though I get an error "Argument or incorrect procedure call" (or something like that). Here's what I have tried:
Me.PivotTables("tcd_transits").PivotFields("NOTE").ClearAllFilters
Me.PivotTables("tcd_transits").PivotFields("NOTE").PivotFilters.Add _
xlValueEquals, "NOTE", "RUBRIQUES"
The first line effectively clears the filters but the second doesn't add a filter on "NOTE" for "RUBRIQUES" and throws the error I mentionned above. Am I completely off the path here or is there a detail I missed ?
Found it here:
http://excel.bigresource.com/Track/excel-0anuDfeJ/
The solution is to use PivotFields.CurrentPage
Me.PivotTables("tcd_transits").PivotFields("NOTE").CurrentPage = "TRANSITS"