How do I output the contents of the same table name in two different databases at the same time?

Updated on technology 2024-08-02
15 answers
  1. Anonymous users2024-02-15

    If the data does not change, or if it is rarely modified.

    You can import the L goods in the sample into the 2008 database, and give it any name, such as sample L goods, and then do a connection query.

    select * from l_goodsunion all

    select * from sample l goods If the data is changing in real time, you can create a stored procedure.

    Implement a connection query between two databases in a stored procedure, if the two databases are in different instances:

    sp_addlinkedserver

    sp_addlinkedsrvlogin

    These two are used to connect the two databases, specifically with the help of the check, otherwise skip this step.

    Also use union all for queries.

    select * from [2008].

    union all

    select * from [sample].

  2. Anonymous users2024-02-14

    LZ uses VB, right, can I use an ADODC to connect two tables? As mentioned above, use the if statement to determine that the first data table does not meet the requirements, use ADODC to connect the second data table, and if the second data table does not, use ADODC to display the first data table.

  3. Anonymous users2024-02-13

    Merge queries with union all in the select language.

    Or use two select statements to return two datasets, each followed by "; and call different datasets with the nextrecordset method.

  4. Anonymous users2024-02-12

    Execute the statement in database 2.

    update t1

    set t1.Field 1 = t2Field 1

    from Table 1 t1 and Table 1 t2

    where -- Enter the condition as needed.

    Alternatively, it is possible to use an accelerant in Table 1 of the database.

  5. Anonymous users2024-02-11

    It's easy to find a DBA and create a DB link.

  6. Anonymous users2024-02-10

    Yes, when executing, pay attention to the complete labeling of the two tables: the database name. Username. Table name.

    For example, insert into

    select * from

    db1 and db2 are the database names, yonghu1 and yonghu2 are the usernames of the database, and bm is the table name.

  7. Anonymous users2024-02-09

    Same server? Same database system?

    Suppose another database is called'Database B'and, of course, the user has access to both databases.

    select into [table] from [database b].[Owner].Table name.

    If not on the same server.

    select into [table] from opendatasource('sqloledb','data source = server name or IP; user id=login name; password=Password').Database BTable name.

  8. Anonymous users2024-02-08

    Whether the two databases are on one server or two servers.

    On a server, this is easy.

    You can update it directly, as shown in sql:

    update testset a=1

    update set a=1

    or insert operations, delete operations, etc.

    If there are two servers, then you need to set up a server link;

    The sql is as follows:

    Server IP + database + table, you can achieve the operation.

    The sql is as follows:

  9. Anonymous users2024-02-07

    Create a dblink

    Then select data from one table and insert it into another table.

  10. Anonymous users2024-02-06

    It needs to be handled with a join query.

    If you have the following 2 tables:

    To query two tables with the same content in the ID and Name fields, you can use the following statement:

    select a.* from test a,test1 b where and ;

    Result: It shows that the where condition of the two tables should be written with the association condition, because the question is that the two fields are exactly equal, so write: and

  11. Anonymous users2024-02-05

    Suppose the two databases are A and B, select object name(id) table, and the name field is from where typestat=3

    except

    select object name(id) table, name field from where typestat=3

    If you have SQL 2005 or later, you can do so.

    Select Object Name(Object ID) table, Name field From

    except

    Select Object Name(Object ID) table, Name field From

  12. Anonymous users2024-02-04

    If I'm going to do it, I'll write my own sentence to look it up.

    Ideas:1Compare the user's data dictionary in the two databases to find out the newly added tables in the original database.

    2.Take out all the existing tables and poll them with dynamic SQL to find all the different records (provided you have a primary key).

    3.A different table or record stores a result table and then generates a report.

  13. Anonymous users2024-02-03

    This problem itself is problematic, SQL Server is just a database management tool, and the database is placed in a folder, so let alone let two SQL Server with the same name exist at the same time, and there is no problem with ten or eight. You connected all of your classmates' computers to your SQL Server in the school's computer room. How many master databases do you have to have on your SQL?

    So this question is of little substance.

    Identification done!

  14. Anonymous users2024-02-02

    If you don't do this, you generally have to process multiple tasks at the same time, all of which are multi-threaded, for example, if you take 10 items from the database, and then open ten threads, and each thread can process one item. These 10 items will take the same amount of time to complete as you will be able to complete them.

  15. Anonymous users2024-02-01

    Find a way to get the data transfer between the two software, so you can determine if the file is allowed to be opened!

    A software modification means that the data is also transferred directly to software B, so that it can be determined whether it is necessary to read the data and whether the data can be read!

    Just wait when you can't read it! This gives a hint"Data is being read. "

Related questions
8 answers2024-08-02

Tools Material: Management Studio.

1. First, on the desktop, click on the "Management Studio" icon. >>>More

3 answers2024-08-02

41.where statement.

42.drop statement: drop table s >>>More

4 answers2024-08-02

To add a route.

For example, broadband is used to access the Internet, and a VPN is used to access your company's internal network. >>>More

4 answers2024-08-02

I'll give you a copy :

PB connects to multiple databases. >>>More

2 answers2024-08-02

sql2000

In the start-program-microsoftsqlserver-enterprise manager interface, open the console root file and record all the numbers to (local) (windowsnt), which has the database, data conversion service. Wait, you can right-click "New Database" in "Database" and you're done. >>>More