Can you use excel lookup table in SQL database pull? - sql

Is there a way to import a lookup table of account numbers from excel and only pull results from the database that match the account numbers listed in the excel lookup table? My lookup table contains thousands of account numbers so I can't manually type in the results that I want to filter for. I am using Microsoft SQL server studio to pull data from a SQL server database.

Yes, from SSMS in the object explorer you can right click on the database Tasks-->Import Data. From there you can use the UI to import the spreadsheet as a table in your database.

Related

Joining SQL Database Table with Excel Sheet Data Using Power Query

I'm accessing a table in a SQL database through Excel Power Query and I want to do a join with some data that I have in a excel sheet. I don't have write access to the database so I'm not able to just create a table with the Excel data there.
Is there a good workaround that would allow me to join the database table with the data in the Excel sheet?
If you load the data from the SQL database in a query you can merge it with another query in the power query editor. You just have to navigate to the power query editor and find the merge button.
The editor will ask which are the two queries you want to merge and to indicate which columns contain the matching data.
Several types of join are supported.

transfer single table data from one Database to other database with same table name?

How can i transfer single table data from one Database to other database with same table name?
I have a database with data and other one has no data.
They are not exactly the same as but one table is the same
Thanks
There are many ways to export a table. Some are,
Using SELECT INTO Query
Select * into Database1.Department from Database2.Department
Using SQL Server Export / Import wizard
a. From SQL Server Management Studio, right-click on the database name in the object explorer, then choose Tasks -> Export Data
b. Choose a Data Source and Destination
c. Select the source table and follow the steps and execute the package
For more info, check http://www.sqlshack.com/how-to-copy-tables-from-one-database-to-another-in-sql-server/
Edited Note:
The above methods are for Microsoft SQL Server.

Excel database values to SQL Server and different tables

I got an Excel file with data which I want to import into a database in Microsoft SQL Server 2008 Express edition.
I do this with right click on a database -> task -> import data.
After this, my data from Excel is loaded in the database in one table.
But I want to seperate the columns from the Excel file into different tables.
So instead of loading all Excel data into one database and table, I want to load the Excel data into one database, but in different tables.
For example: Save column 1,2,3 from Excel in table A, and save column 4,5,6 from Excel in table B.
Anyone that knows how to do this?
I followed the suggestion of #bendataclear:
"Personally I would just import into a temporary table then write INSERT INTO X SELECT queries to move in the correct columns."

How can I join Excel column and SQL View?

I have an Excel spreadsheet, with one worksheet, with one column, containing key values I want to use to lookup data in a SQL Server view.
I can import the view data just fine using ADO or ODBC, but cannot figure out how to have the "Microsoft Query" tool add both the Excel Worksheet and the SQL View in a single query, so that I can join the data. I had also hoped VLOOKUP might lookup external data, but did not find anything,
I have looked for hours and am stumped. Certainly this can be done somehow where I can use a key in an Excel file to fetch a single related SQL table row back into Excel? I'm a hard core C# developer but seem to regularly struggle with Excel...
I would import the excel data into a staging table in your SQL Server database.
Of course you can use ADO to get the excel data into SQL Server.
Then you can join the view with your staging table.
hope this helps.

Copy (Import) Data from Oracle Database To Another

I want to Copy a data from One oracle database to another.
I have checked Import/Export Utility but the problem is import utility doesn't support conflicts resolution techniques between rows.
For Example if there's a table in the source database have the same row key in the destination database. if i use 'Ignore' parameter with value = y, the destination table will have a duplicate rows.
I want to ask if there's another way to import data from oracle database to another with some mechanism of detecting the conflicts and resolve them?
You might want to consider using a database link from database A to database B. You can query the data from database B to insert into your database A tables. You are free to query whatever you want using SQL or PL/SQL.
More on database links:
http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5005.htm