Tables not mapped error, after clicking 'Generate DB from Model' - visual-studio-2010

Working in VS2010. I added 4 columns to a table in the database, then opened the project edmx file to 'Update from the Database'using the built in link. By accident, I clicked 'Generate Database from Model'. I redid the 'Update Model from Database' but it did not update. I tried rebuilding but then I got an error:
Error 1 Error 3027: No mapping specified for the following EntitySet/AssociationSet - PersonAlias, Waiver, v_LocationsAlphabetical, Identification, RestrainingOrderData, CivilCompromiseData, DiversionData, FelonyData, PendingOffenseData, ViolationData, PreviousLocation, RequestedVolunteerData, History, Person. C:_VS Projects\entity.edmx 523 9 myApp
It is saying all the tables are not mapped. I assume a duplicate database or something was created when I hit that 'generate database' button. Where is it? How do I get rid of it?

When you click Generate database from Model it only creates SQL script which you have to execute first. You should also not combine Generate Database from Model and Update Model from Database. Use only one of these approaches.

Related

can I influence the dump/export order at the h2 SCRPT command

I've a h2 schema with some tables and a view.
The view is defined by:
CREATE FORCE VIEW PUBLIC.VIEW_TEST(NAME_,STREET_) AS
SELECT
USER.NAME_,
ADDRESS.STREET_
FROM
PUBLIC.USER
LEFT OUTER JOIN PUBLIC.ADDRESS ON USER.ADDRESS_= ADDRESS.ID_
After dumping (via "SCRIPT TO ..."), within the dump file, the "CREATE FORCE VIEW PUBLIC.VIEW_TEST ..." is before the "CREATE TABLE ADDRESS ..." clause. This table is joined within the view.
The result is, that after restoring the schema (via "RUNSCRIPT FROM ...") the command "SELECT * FROM VIEW_TEST" returns a error that the referenced table "ADDRESS" is unknown:
View "PUBLIC.VIEW_TEST" is invalid: "Tabelle ""ADDRESS"" not found
Table ""ADDRESS"" not found [42102-197]"; SQL statement:
SELECT * FROM VIEW_TEST [90109-197] 90109/90109
If I drop the view and recreating it, everthing works fine, but I want to automize the dumping and restoring process.
Is there a way to set the ordering of tables and views?
What is the best way to ensure, that the view definitions are at the end of the dump?
Many thanks
No, there is no such way.
Here is a related bugreport:
https://github.com/h2database/h2database/issues/2390
If you use the persistent database you can close the connection after execution of RUNSCRIPT command (make sure that you don't use DB_CLOSE_DELAY or use the SHUTDOWN command) and re-open it. The views will be initialized properly on startup.
If you use the in-memory database, the only workaround is to recompile your views with
ALTER VIEW VIEW_TEST RECOMPILE;
ALTER VIEW otherView RECOMPILE;
.....

How to 'ALTER VIEW' in HP Vertica

In my new project, I am connecting to HP vertica using DBeaver. I have created a view on a large database (about few billion records) with size limit of 300. This view was created to setup other systems in the pipeline. After everything is setup, I want to remove the size limitation of 300 from the view and want to return all the data. Unfortunately, I can only find that command 'ALTER VIEW' for HP Vertica is allowed to simply rename the view and not modify the view itself. I am forced to drop the view and create another one but this breaks the already established data connection from other systems (Tableau) to the original view.
https://my.vertica.com/docs/7.1.x/HTML/Content/Authoring/SQLReferenceManual/Statements/CREATEVIEW.htm
and
https://my.vertica.com/docs/7.1.x/HTML/Content/Authoring/SQLReferenceManual/Statements/ALTERVIEW.htm
I tried using ALTER VIEW command as in SQL but I get an error -
SQL Error [4856] [42601]:
[Vertica][VJDBC](4856) ERROR: Syntax error at or near "AS"
[Vertica][VJDBC](4856) ERROR: Syntax error at or near "AS"
com.vertica.util.ServerException:
[Vertica][VJDBC](4856) ERROR: Syntax error at or near "AS"
CREATE OR REPLACE VIEW etc etc.
https://my.vertica.com/docs/7.1.x/HTML/Content/Authoring/SQLReferenceManual/Statements/CREATEVIEW.htm

views calls a function on a different database but crystal reports "invalid identifier" error

I've created a view (generic_view) on a database (database1) in schema (general_schema). One of the columns in this view is populated by a function (generic_function) which is stored in the same schema but on a different database (database2). I'm calling the function like:
general_schema.generic_function#database2(param1, param2, ... paramN) AS function_column
The view and function both compile, and the view generates data for the function_column function. The problem occurs when I try to use this view in crystal reports to generate a report. When I try to add the view I get the error:
ORA-00904: "general_schema"."generic_function": invalid identifier
I tried removing all of the content inside the function so that the function just returns 0, but that didn't seem to help.
I'm I calling the function wrong?
The schema names being the same in different databases doesn't mean they're the same schema. You'll need to have a database link set up in database1 to allow access to database2, and then in database2 you'll need to be sure that the user specified in the database link has been granted EXECUTE access to general_schema.generic_function.
Best of luck.

How to copy data from one database/table to another database/table in oracle using toad

I am trying to copy a table data from dev box db to uat db which are 2 different data bases . I am trying in toad.All the connection details are correct but its not working and throwing the following error.
[Error] Execution (12: 1): ORA-00900: invalid SQL statement
This is what i am trying
copy from abc/cde#//abc.abc.com:1521/devbox to abc/cde#//abc.abc.com/uatbox
INSERT TOOL_SERVICE_MAPPING (*)
USING (SELECT * FROM TOOL_SERVICE_MAPPING)
If your table doesn't have a huge number of rows you can use Toad's Export function: it creates an insert statement for each row. You can then run these statements in destination DB to re-create your table's data.
Here are the steps:
A. Create a copy of the table in destination DB
in source DB in a schema browser window click on the table you want to copy, select "script" tab in the right part of the window: you will find the script to re-create your table; copy this script
paste the script in a new SQL editor window in destination DB and run it. This should create the new table
B. Copy data in new table
in a schema browser window right click on table name in source DB
select "Export Data" from context menu
write "where" statement of your export query (leave it blank if you want to copy the entire table)
select destination: clipboard
click "ok" (now insert statements are stored in your clipboard)
paste insert statements in a new SQL editor window in destination DB
run statements as script (shortcut F5)
copy is a SQL*Plus command, not a SQL statement. I would be surprised if Toad had implemented that particular SQL*Plus command (it does implement many of the simpler commands). If you want to use the copy command, you would need to use SQL*Plus, not Toad.
If you want to use Toad, you would need to use a SQL statement to copy the data. You could create a database link in the destination database that points to the source database and then
INSERT INTO tool_service_mapping
SELECT *
FROM tool_service_mapping#<<db link to source database>>
The easyest and most error-free way I have experienced so far is: Database->Compare->Schemas
It's not too complicated as it looks (lots of checkboxes), but you tick boxes for objects you need to be created in an empty database, and at the end of comparison you end up with SQL script including all objects (triggers, views, sequences, packges) that you selected (checkboxes).
I clearly see all tables, triggers, data, etc in generated sql script and even can tick these I don't wish to create (if any)... Before executing script, TOAD asks you to confirm against which database you are running the script - saved me few times... As ackward as it looks, it works perfectly.
I have arround 200 tables I don't know if this is suitable for huge databases.

Operation must be an updateable query - VB Script, Paradox Table

I'm using a Win XP box with BDE Administrator and Access 2007 installed. I'm able to open and perform select queries on existing Paradox tables without problem but have some very strange behavior when attempting INSERT/UPDATE. I can even create a new Paradox table and it has the same behavior. Here is sample code:
' create new table
conObj.Execute "CREATE TABLE test (id INT, comment VARCHAR(30))"
' first insert works fine
conObj.Execute "INSERT INTO test VALUES (1, 'something')"
' second insert fails for unknown reason
conObj.Execute "INSERT INTO test VALUES (2, 'something else')"
I've tried using Jet 4.0, MS Access Paradox driver, and native Paradox driver connection strings but all yield the same result. On the second insert statement it throws an error:
Operation must be an updateable query
I've read numerous posts in forums and pages on help sites that tell me this error is caused by a file permissions issue. The account running this script is part of the Administrator group and I've changed file permissions to allow the Everyone group Full Control of the db file but this changes nothing.
This page put out by Micrsoft Support did not fix the problem: http://support.microsoft.com/kb/175168
Additionally, I can create a new table but any time I try to create a PRIMARY KEY or UNIQUE field I get an error message that says:
"Index_[random characters] is not a valid name."
try
"CREATE TABLE test (id INT, comment VARCHAR(30), primary key(id))"
I don't know much about Paradox databases but this has indeed been a learning experience. Even though I have a table file called table.db that's not enough to store more than a single row of data. I also need several other files to insert or update a paradox database:
table.DB
table.PX
table.VAL
table.XG0
table.XG1
table.YG0
table.YG1
I was nosing around in another program that generates paradox databases and found when I copied a blank database from it along with these other files it generated I was able to insert and update without problems. I have no idea what these files are for or why they need to be present to insert or update but having them present fixed my issue.

Resources