Delete Multiple Table In single SQL Query? - sql

I am using Room Database over SQlite and Live Data in my android application. I need to delete whole table data not database so I am going to delete table in separate Query like:
DELETE From Table_name
But I want to delete multiple tables data not drop in single Query not all tables. So please give me an appropriate solution.

Related

How to delete all data from tables in a SQL Server 2014 database, but keep all the tables?

As stated I need help deleting all data from every table in a test database. There are 3477 tables and some of the tables were created by a past employee so I was unable to create a schema of the DB and recreate it empty.
Is there a fast way to delete all of the data and keep all of the tables and their structure? Also, I noticed when deleting data from the DB with Delete table_name, that the data file wasn't decreasing in size. Any reason why? Then I tried to just delete the data file to see what would happen and it erased everything, so i had to restore the test database. Now I'm back at block one....
Any help or guidance would be appreciated.... I've read a lot and everything just says use Delete or Truncate, but rather not do that for 3477 tables.
The TRUNCATE TABLE command deletes the data inside a table, but not the table itself.
You have a lot of tables (more than 3000...), so take a look to following link to truncate all tables:
Truncate all tables in a SQL Server database

Updating the content of a database with the content of another database

im new to SQL and can't figure out why my sql script isn't working.
I've two databases, and my task is to update a column of a specific table with the content of the same table in the other database if the conditions are met. The tables and columns of both databases have the same names, just party different content. I already looked through a lot of similar questions, but couldn't make it work / figure out what i did wrong.
UPDATE TABLE1
SET COLUMN_1 = Database2.TABLE1.COLUMN_1
WHERE Database2.TABLE1.COLUMN_2 LIKE '%DIN276%';
(Im running the query on the first database)
PostgreSQL database does not support cross-database queries.
You must create in your Database1 a foreighn data wrapper for TABLE1 from Database2, then you can perform queries with your TABLE1 in Database1 together with data from TABLE1 of Database2.

How to delete all the entities in Azure table?

I've been working on deleting all the rows in Azure table in java. Can I do it without querying it?
Thanks in advance
If I retrieve all the data, can I perform delete query on that?
If you just want to delete data, you just need to retrieve PKs and RKs. After retrieved all the data of PKs and RKs, you could perform the delete query for the entities one by one.
For complex delete query, for example, below query is not supported currently.
delete from tablename where PK = ''
I suggest you submit your idea on Azure feedback site which is used for features request.
https://feedback.azure.com/forums/217298-storage
If you don't want to query the table, what you can do is to delete the table and recreate it.

Cannot add records to Access linked table via query, but can update and delete via query and add directly to the table

I have an Access front end for a SQL database. I can add, update and delete records directly in the tables from Access. I can also update and delete rows from queries based on those tables. However, I am unable to add records to any queries. They can be simple queries based on one table with no criteria, it doesn't matter. I am unable to add rows.
I am the db owner, by the way, so permissions should not be a problem. Also, like I said, I can add directly to the tables, just not through queries.
Have any of you experienced this behavior?
Thank you for any help you can provide!

Can I do a INSERT using select from another DB with the same table name

I have a person table (sqlServer 2008r2) and are using .vbs and .bat files to sync some data from a table called person in database A to database B.
Note - The DB names are different but the table names are the same. Because the peson table has 137 fields I am looking for a way to write both an INSERT and an UPDATE statement. How can I do thsi without listing 137 fields?
At the moment I connect to database A and populate a recordSet called RS with the people table records.
Then I loop through RS and query the people table in database B
If found I update people table in database B with the people table record from database A
If not found I insert the people record from database A into the people table on database B
Now this is nice and easy but since it has 137 fields I do not want to write a MASSIVE update and insert statements. DO I have another option such as:
The table structures are identical between people on database A and people on database B but the recordset obtained in step 1 above is using one one DB connection and the query in step 2 is using a separate DB connection to a different DB instance on a different server.
Help.
You can do that by using a fully qualified name.
insert into DATABASE1.dbo.Person (columns)
select (columns) from DATABASE2.dbo.Person
Also there are others way to pump data from a database for another
You can take a look on your MSSMS it got a tool for that kind of thing.
Select one database and right button mouse to open the import/export wizard.
You can also take a look on replication, bulk copy, service broker, etc...