Does someone know how can I connect multi-DB-servers for clearing code or samples [closed] - sql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have found out a lot of messages from stack overflow but it is too much information to me , and I didn't see any clear code ,I wish I can use like as below URLs with easy way
Querying data by joining two tables in two database on different servers
Selecting data from two different servers in SQL Server
PS: sorry for all , maybe my English isn't very well ,so that I cannot understand or know , hopefully someone can give me a very simple code

This sample is very easy , hopefully it is you want
1.Data Source <=Server ip or ServerName
2.Initial Catalog <= DB Name
3.User ID <= Account ID
4.Password <= Account PWD
5.[*****].[dbo].[awards] <= which table you want to find out
SELECT *
FROM OPENDATASOURCE('SQLNCLI',
'Data Source=10.***.***.***;Initial Catalog=B2C**;User ID=****;Password="****"')
.[*****].[dbo].[awards]
PS: more detail you can see
https://msdn.microsoft.com/zh-tw/library/ms179856(v=sql.120).aspx
or Querying data by joining two tables in two database on different servers
or Selecting data from two different servers in SQL Server
it will be gave you more detail ways or methods

Related

How does one query a database? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Original close reason(s) were not resolved
Improve this question
How does one get the first name info from a Users table, which has a first name column?
First of all welcome to the community. I suggest you read the guidelines on how to properly ask a question here and you might want to write a title that is relevant to your question.
Now to the question:
Assuming tblUsers is a table in your database and 'first_name' is a column in your table, you can use SELECT followed by the column you want to select.
Lastly, add FROM to select which table you want to select from.
So in your case it would be:
SELECT first_name FROM tblUsers;
You can read more about SELECT here

Unable to copy a table into a new table [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I'm trying to clone a table schema and data into a new table, this is what I'm doing:
SELECT * INTO 'ECO7053__settings' FROM base__settings
I keep getting the Undeclared Variable error
EDIT: Also to complete the questions, is this the correct approach? I need to store data for different users; is it better to add an uID field on my tables and filter by that or rather what I'm trying to do, and have different tables one for each user with a prefix? In the example the uID would be 7053 what would be the correct way to handle this situation?
CREATE TABLE ECO7053__settings LIKE base__settings;
to copy the table schema and indices. Then
INSERT INTO ECO7053__settings SELECT * FROM base__settings;
to copy the data.
Use:
SHOW CREATE TABLE base__settings
Copy the create statement and change base__settings into ECO7053__settings (do a search and replace)
Then run
INSERT INTO ECO7053__settings
SELECT * FROM base__settings

access multiple my sql database at a time? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
how can i access multiple my sql database at time, what is the mechanism behind it?????
eg: i have three different database that contain product(shoes) along with price and there description etc...
so whenever the user type shoes and set its price ... my search bar should be able to retrieve the data in respect of price.. from multiple database..
You can use like
Select * FROM database1.products WHERE field = ?
UNION ALL
SELECT * FROM database2.products field = ?
UNION ALL
SELECT * FROM database3.products field = ?

In Oracle SQL, how do I find where a column may be referenced using just queries? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have a specific column, called DELIVER_TO_LOCATION_ID , which is in a table called apps.po_requisition_lines_all
I need to dig into the database and derive the continent from the DELIVER_TO_LOCATION_ID ,
In SQL Developer I can't seem to find a way to do this .
any tips appreciated. thanks
You can use following command-
desc tableName
It'll give you description of table including every column in it having any constraints on it or not like primary key, reference key etc.

Simple select query running slow [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have about 1000 entries in table. It's simple table with 10 columns. Query:
SELECT * FROM my_table
server runs the query, but is processing it for a long time.
P.S. I know this is not enough info, so please comment and I will add what is needed.
Got it. Not related to SQL. Server got overflown by data. Someone was spamming it.
You can try to use TOP. For example try to select 100 rows and look if server still stucks:
SELECT TOP 100 * FROM my_table