Database Query

Closed
deep - Jun 18, 2009 at 06:53 AM
tommo2785 Posts 15 Registration date Wednesday June 17, 2009 Status Member Last seen June 19, 2009 - Jun 19, 2009 at 01:13 AM
Hello,
How to create a table from Database to a different database through SQL Statement ??

3 responses

1. i have two server instance A and B in my SQL SERVER,i have connected two instance at a time A and B for a example.Now i want to create a table from A instance to the B instance through SQL Editor

2. Can i connect SQL SERVER Database using Command Prompt.
1
tommo2785 Posts 15 Registration date Wednesday June 17, 2009 Status Member Last seen June 19, 2009 2
Jun 18, 2009 at 09:42 AM
Please restate your question as it is difficult to understand
However if i have interpreted the question properly you want to copy a table from file-a.db to file-b.db
Easiest way would be to dump the contents of a table into a file (probably .txt) with HEADERS OFF in MODE COLUMN.
Go to file-b.db and INSERT INTO tablename VALUES and pull up the dump file.
Not sure if that will work as i have never tried it. If you can't find the answer somewhere let me know, and I will scour through my Text books and Notes.
Also I have never tried SELECT from one db querying another. Look into this as I'm sure depending on your DBMS it might be possible if so do SELECT INTO as your query.
Let me know how you go, If you don't have much luck contact me and I will try to get you the answer out of my book, I'm a bit fuzzy atm. It's 1 in the morning here, and ill help you tomorrow when i wake up.
thompsontrading@gmail.com
0
tommo2785 Posts 15 Registration date Wednesday June 17, 2009 Status Member Last seen June 19, 2009 2
Jun 19, 2009 at 01:13 AM
I am not familiar with sql server at all. All the SQL work i have done is on mySQL and SQLite.
However a quick search revealed this https://stackoverflow.com/questions/211142/sql-server-2005-best-way-to-move-data-between-two-databases-when-primary-keys
There are several options discussed which all look like candidates and the second answer is along the same lines as my original reply

As afar as your question on wether you can connect to view your db through command line i would say its almost a definite yes as the most widely used DBMS in the world mySQL is still a text program. Although you can get GUI applications for it. At the end of the day a DB is just a collection of a lot of tables. Like an Excel file, but with good quering powers and with check functions etc.
Hope this helps mate
0