ORA-20085: Different SRID's - database

Here is my case. I had 2 geodatabases. Second one is created later. And i import all tables in geodatabase-1 to geodatabase-2 by using ArcCatolog. I use srid 6 for my geodatabase 1 and its kind of a standart. But in geodatabase 2 the tables and indexes are imported with an different srid. I have to change srid of all geometry collumns and spatial indexes to 6.
First i checked ST_spatial_references table for srid 6 and couldnt find it. There is srid 30002 with same content with srid 6 in geodatabase 1.
Then i create an entry in ST_Spatial_references table manually for srid 6. After that I tried to create a spatial index with following query.
CREATE INDEX SDE.INDEX_NAME ON SDE.TABLE_NAME (SHAPE)
INDEXTYPE IS SDE.ST_SPATIAL_INDEX
PARAMETERS('st_grids=1:0:0 st_srid=6')
NOPARALLEL;
and get this error. ORA-20085: Different SRID '6' do not match.
I need to create and srid entry with id 6 properly. And change all the tables and spatial indexes set to srid 6. Can anyone help me?
Note: srid 30002 and 6 has exactly same content in ST_SPATIAL_REFERENCES table except the id collumn.
Thank You.

The reason you're seeing that error is that the SRID of a table (defined in the ST_GEOMETRY_COLUMNS table) doesn't match with the one of the geometries contained in it (defined in the geometry field of each record).
If you really need to change the SRID of a table (even though you shouldn't mess with SRIDs, as they are internally managed by SDE), follow this procedure:
Create the entry in the ST_SPATIAL_REFERENCE table with SRID=6
Remove with ArcCatalog any existing spatial index on the table. If it doesn't work try to recreate it and then remove it.
Update the geometries contained in the table with the following SQL command:
UPDATE b SET b.shape.srid = 6
Update to 6 the SRID of the table in the ST_GEOMETRY_COLUMNS table
Create the spatial index with ArcCatalog
This has to be done for each table (except of course for the first step which has to be done only once).

Related

Need help in a MS SQL DB design

Hi I have 2 type of data entry which needs to be stored in db so it can be used for calculations later. Each entry has a unique id for it. The data entry are -
1.
2.
So I have to save this data in DB. With my understanding I thought of the following -
Create 3 tables - Common, Entry1 and Entry2(multiple tables with unique id as name)
The Common table will have a unique entry of each data and which table refer to for the value (Entry1/Entry2).
The Entry1 data is a single line so it can be inserted. But the Entry2 data will require a complete table because of its structure. So whenever we add a type 2 entry then a new table has to be created, which will create a lot of tables.
Or I could save the type2 values in another database and fetch the values from there. So please suggest me a way which is better than this.
I believe that you have 2 entry types with identical structure, but one containing a single row and one containing many.
In this case, I would suggest a single table containing the data for all entries, wtih a second table grouping them together. Even if your input contains a single row, it should still gain an EntryID. Perhaps something like the below:

Transfer data from one column to a different column in a different table

I've got table A and table B in a database. I'm trying to move the column in table A to table B without losing any data. Not sure if its best to move the column somehow or make a whole new column in table B then copy the data over?
The problem is that the database is already in production and I don't want the clients to lose the data that is currently stored in column X in table A. I thought of making a migration to create the same column X in table B, and then somehow copying the data there. I am not sure how to do that, and I couldn't find a similar problem here.
if you have phpmyadmin you can do this pretty easily. this command should work:
INSERT INTO `tabletwo.columnb` (SELECT 'columna' FROM tableone)
Always back up the dbs, load local and try this, never live lol. I'm sure your aware. :)
Note: columna and columnb are placeholder for your actual column names
I think you can create the migration table to create de column on table B.
After you can use tinker ("php artisan tinker" on the terminal) to move the desired data on the table A to the B.

SQL equivalent query in Qlikview?

In SQL we can write query like:
Select field1,field2,field3,field4,field5,field6,field7
from table1 t1,table2 t2,table3 t3
where t1.field1 = t3.field3 and
t2.field2 = 'USD'
In Qlikview, I have created QVD's for 6 tables, now I want to create a single QVD of these 6 QVD's. Unfortunately these tables don't contain primary keys. So I cant use join. I have tried like this also:
fact:
load *
from
[D:\path\fact*.qvd](qvd);
//To store all qvd's into one qvd.
store fact into [D:\path\facttable.qvd];
This query creates a facttable but only with 2 columns, these columns are of first fact table. Diagram shows it much clear:
As it internally gives the name of all the facts table with fact, fact-1, fact-2 and so on and I have written the query store fact into [D:\path\facttable.qvd]; and in this diagram fact table contains only two columns so it creates the fact table with two columns only.
Please let me know the solution that how can we write this query in Qlikview or how can we create a fact table using all the QVDS?
Thanks in advance.
Since every qvd contains different field names it will create several tables with synthetic keys when you load *.
You can use Concatenate Load to stack each qvd onto one fact table. One simple example would be to first create a Fact table by:
Fact:
Load * INLINE [
dummyField
];
Now you can concatenate the qvd's onto that Fact table:
concatenate(Fact)
load *
from
[D:\path\fact*.qvd](qvd);
//To store all qvd's into one qvd.
store Fact into [D:\path\facttable.qvd];
//drop the dummy field.
drop field dummyField;

How to store dashboard definitions in oracle database

I am creating a system for displaying dashboards. A dashboard is made up of a number of dashlets of different types e.g. a trend, a histogram, a spiderplot etc.
Currently I define each dashlet as a row within an oracle table. My dilemma is as follows. Each type of dashlet has a different set of parameters such as line color, y axis title, maximum y etc. Up to now I have been creating a different column for each parameter but this means that I have a very large number of columns and many of the columns are not relevant for a particular dashlet and are left empty. I have now tried using a single column called definitions which contains information defining the characteristics of the dashlet. Example below.
ytitle: Count|
linecolor: Yellow|
linethickness: 12|
.....
The problem with this is that if you mis-spell an item the program will fail at runtime.
What is the best way to tackle this problem.
You can create table, let's say t_parameters, where parameter name(ytitle,linecolor) will be primary or unique key. Then you can create a foreign key on your parameter_name column which is in your definition table (the one storing assingment: ytitle Count,etc...)
Now if you want to ensure that also parameter value is from exact list, you can do the same by creating table of parameter values and creating unique key and then foreign key in definition table.
Then if you need it to be more advanced and check which parameter can be of which values you can create lookup table having columns parameter_name,parameter_value like:
linecolor; yellow
linecolor; red
Ytitle; sum
Ytitle; count
This is one way how to ensure reference integrity.
Best practice would be to set in t_parameter for parameter_name an numeric id and made this to be PK and reference these in lookup tables.

Create index on two unrelated table in Solr-2

I need to create index from two tables that are not related. But when I try to do so I get the response that record fetched is equal to both tables records but no index in created.
Please help
Creating 1 index from 2 unrelated tables sound very strange. Why can't you create 2 indexes?
In case you don't have other choice create unique id filed in schema (look at http://wiki.apache.org/solr/UniqueKey). Check also in DB logs what queries are actually run.

Resources