How to access data from two different tables in SQL Server 2005?
Posted on | July 21, 2008 | No Comments
howdy,
well I was having a problem where I needed to populate the table of my SQL Express 2005 database from another table in another database. So I wrote the query in the following fashion:
INSERT INTO debtdb.SchemaName.TableName (column1, column2….)
SELECT Column1, column2…
FROM dbName.SchemaName.TableName
my sample query was this
Insert into db2.dbo.tblNationality(NationalityName)
Select
Name FROM db1.dbo.tblNationality
what it does is that it takes the data from the database called db1 and inserts it into another database –on the same server, called ‘db2′.
Category: SQL Server 2005
Tags: Database table > get data from different tables > populate database table > SQL Express 2005 > SQL Server 2005
Tags: Database table > get data from different tables > populate database table > SQL Express 2005 > SQL Server 2005
Comments
Leave a Reply




