How to use Access database with query as pivot table in Excel - database

I want to use Access database with query for pivot table in Excel.
How do I do that?

Open Excel and select Data->Pivot Table....->External data source->Get Data.
Then select Microsoft Access MDB and find your MDB file. Select the
appropriate tables and/or queries and fields.

Related

Insert data into SQL tables manually using the related columns in Management Studio

I am trying to insert data into some related table in SQL Server 2008R2 and I am trying to figure out whether there is an easier way to insert data manually (visually) using the related columns and not the IDs. If you check the two snapshots of the tables and table WFUserGroup basically I am trying to see if I can have a bound query (like in MS ACCESS) where I can see the Name column instead of the ID and the name of the Group instead of the group_id
I know that with a TRANSACTION block and INSERT INTO statements I can create a new user in WFUser table and then relate it to a group in the WFUserGroup table, but I am telling myself there should be an easier way. Anyone knows a workaround?
Tables:
Using Edit Top 200 Rows Feature:
You could use a flat file with data in a .csv or excel and use the Import feature in SQL server.
how to navigate, right click on the database and tasks--> Import then the wizard to select the necessary file and tables.
I do see that there are primary key and foreign keys so you have to make sure that its considered in your files you are going to import.

SQL - data from select in excel file

i have next query
select no,
item
from myTable
and I get next table
no item
1 a
2 b
3 c
4 d
I use tsql, Microsoft SQL Server Management Studio.
Is there any way to write here some code to export table from my select in excel...
I am not aware of any way to write a query in SSMS and then export the results to excel, but you can connect an excel sheet to SQL Server and run queries into an data table from there using the From Other Sources - From SQL Server menu in the Data tab on the ribbon:
This is good if you want to build on that data within Excel and you need to refresh the data but don't want to update your formulas. There are obviously security implications with this as users of the Worksheet may be able to access other data on your server.
If you want to simply export an Excel file with data in to a file store, you would need to use SSRS and a report subscription. Alternatively, if you simply want to save the results of your query to a file, you can either copy and paste manually or choose to Save Your Results To Text in SSMS:
from your excel sheet you can create a dynamic connection between a SQL Server database and your Excel workbook.
Follow the steps in below link.
Steps to Connect a SQL Server database to your workbook

Read Oracle DB FROM Microsoft SQL Server Manager 2012 to find Unknown Table

I am working on a project that requires me to read/write to an OLEDB. I do not know what table the information I'm looking for is in and there are about 150+ tables. Is there a way to search each table for a certain column header without querying each table one by one? so far I've just been doing
SELECT * FROM [name]..[name].[name] GO
And reading the headers in data grid view on a vb.net program I made.
Try this if you have a user with dba privileges on the Oracle database.
SELECT OWNER, TABLE_NAME,COLUMN_NAME
FROM sys.dba_tab_columns
WHERE column_name LIKE UPPER('%Your column name%');

using ADO.NET to select from multiple VFP tables

I need to select from 2 VFP free tables on some different network locations.
I've managed to get both tables into a dataset as two DataTables and add a Relation for them.
Now I need to join them and the result to insert into a SQL server database.
Any ideas?
Use two different queries to load the required subset of rows and columns from each table, upload each table individually to temp SQL server tables (using SqlBulkUpload), and then run your query in SQL against the two temp tables to create the required table.
Use Microsoft Access to add them as linked tables. You can then read the data from .net as though it were native Access data. You might be able to create queries in Access that join the tables and then read the queries from .net too.

SQL BULK INSERT with on the fly table creation

I would like to use BULK INSERT to load a few hundred raw data tables into SQL Server. The format of these tables would be similar, although not identical (they come from excel sheets which are not tightly version controlled).
I want to know if there is a way to dynamically generate the table required on SQL Server depending on the headers in the file to be loaded, and then do the BULK INSERT thereafter.
You can connect to those Excel tables using OPEN ROWSET. Then, do the following:
SELECT *
FROM Excel
INTO NewTable
WHERE 0=1
This will transfer the schema. Is this what you want?
You can make an excel script that generates sql statements for creation of the tables, then execute the file before bulk insert the data.

Resources