Connecting Excel 2010 to SQL Server: Pulling multiple tables from one connection - sql-server

I want to connect an excel file to several tables in SQL Server. I learned how to make the connection by going to
Data - > Get External Data -> From Other Sources - > From SQL Server
and inputting the server name and selecting a table.
I want to select about 10 more tables. Is there a way to select another table since I have already set up the connection? Or do I have to go through this whole process each time?

In my experience the best way to do this is to use an Excel Add-In called Powerpivot: https://msdn.microsoft.com/en-us/library/gg413497(v=sql.110).aspx
It has a data import feature where you can import multiple tables at once from MS SQL Server (and actually supports import for many other database and file types).

Related

SQL Server data transfer from one server to another server

I want to transfer multiple tables and their data from one SQL Server to another SQL Server on the local network automatically every 1 hour.
There is a tool built-in tool in SSMS to do this.
In SSMS, right click on the database name. Select Data > Import on the destination database. You will be prompted to provide connection information for the source database. This is internally using SSIS integration tool.
Create a SSIS Package USE Type two SCD if you want insert and
updates. you can use staging table from source to
destination is a good practice and it is industry standard. if you
are not having staging environment. You can use temp tables within
ssis package to achieve the same.
Schedule a job and run that ssis package in the job for every half an hour

Copy data from one table and save it into another table in different database on different SQL Server

I have two different databases in two different SQL Servers. The databases are identical in schema but contain different data in one of the tables.
I want to copy all the data from one table in one database to the same table in the other database so that I can get rid of the database from which I am copying the data.
The data is too large so I cannot create data scripts and run it onto other database.
How can I achieve this?
There are many ways like ssis transfer,select * into ,but i prefer below way if you are just transferring data
create a linked server on source server for destination server,then you could refer destination server with four part name
Assuming linked server of source is A and destination server is B,data moving is as simple as
insert into B.databasename.Schema.Table
select * from table---this is in source server and db
if data is huge and you may worry about time outs,you can write a simple script which can do in batches like
While (1=1)
begin
insert into B.databasename.Schema.Table
select top 10000* from table---this is in source server and db
if (##rowcount=0)
break
end
Creating linked server ,you can follow this
You have the following options available to you. Not all of these will work, depending on your exact requirements and the networking arrangements between the servers.
SQL Server Management Studio - Import & Export Wizard: this is accessed from the right-click menu for a database > Tasks > Import Data (or Export Data).
SQL query using a Linked Server: a Linked Server configured between the two servers allows you to reference databases on one from the other, in much the same way as if they were on the same server. Any valid SQL query approach for transferring data between two tables within one database will then work, provided you fully-qualify the table names as Server.Database.Schema.Table.
SSIS: create an SSIS package with both servers as connections, and a simple workflow to move the data from one to the other. There is plenty of information available online on how to use SSIS.
Export to flat-file format then import: this could be done using the Import/Export Wizard above or SSIS, but instead of piping the data directly between the two servers, you would output the data from the source table into a suitable flat-file format on the filesystem. CSV is the most commonly used format for this. This file can then be moved to the destination server using any file transfer approach (compressed e.g. to a Zip file if desired), and imported into the destination table.
Database backup and restore: Similar to (4), but instead of using a flat file, you could create a backup of the source database via Tasks > Back Up... You then move that backup as a file (just like the CSV approach), and restore it onto the destination server. Now you have two databases on the destination server, and can move data from one to the other locally.
I hope, this query helps you!!!
INSERT INTO [dbo].[tablename] (Column1, Column2,Column3)
(select Column1, Column2,Column3, from [Database1].[dbo].[tablename]
Thanks!!!

Possible ways to migrate data from MS Access to SQL Server 2008 Express

I have database in MS Access in which new table is generated to store the records of each day. I want to transfer the data from the current day table to SQL Server Table.
In SQL server I have only one table and Data will append everyday.
What are the possible ways to achieve this functionality.
Thanks
There are many ways you can do this.The one is Import Export Wizard which is listed below:
1) Using Import-Export wizard: This will do is get the data from source (for you will be Access) and put it in Destination database ( which will be SQL Server)
You can call this package through SQL Agent ( you can make it run every day, weekly, monthly)
Import and Export wizard
http://www.packtpub.com/article/transferring-data-ms-access-2003-to-sql-server-2008
I would explore creating a Linked Server to Access, and create a stored procedure to load the data, which you could schedule with the Windows Task Scheduler and sqlcmd.
Taken from MSDN post
http://social.msdn.microsoft.com/forums/sqlserver/en-US/015d8295-a57a-4dc9-b3e2-6da1cfe8ab6d/convert-an-access-db-to-sqlexpress
Access has a tool called the Upsize Wizard built directly into the product to help you do this. A second alternative is the SQL Server Migration Assistant for Access, which you can learn about here http://technet.microsoft.com/en-us/library/hh313039.aspx.
Download link below
http://www.microsoft.com/en-in/download/details.aspx?id=28763

Import CSV into SQL Azure Database using SSMS

I have a set of large CSV files with many columns each that I need to import into a SQL Azure database. Ordinarily I would use the import wizard in SQL Server Management Studio. However, the wizard does not appear to be an option when connecting to SQL Azure in SSMS. Is that correct? And if so, what is the recommended tool for accomplishing this task? I'm looking for a tool that will infer from the data what the columns should be allowing me to override the data type as needed. Since I have a lot of columns in each of the files I'd like to avoid the tedious work of manually writing the SQL code to generate the tables.
This worked for me:
Open SQL Server Management Studio
Connect to Azure
Right-click the database
Go to Tasks > Import Data
Select your flat file(s)
Upload to Azure SQL and create an SSIS package based on this workflow
I sometimes get errors with CSV files this way, but either using an Excel file or inspecting the options of the CSV data columns in the Import Wizard should suffice.
Make sure you have appropriate permissions assigned to your user account.
They could've / should've made this easier, like a SFTP + insert or a GUI import directly to Azure SQL like in Hue.
When you are transferring any data to SQL Database, the data should be structured. The proces will be to convert your CSV to a table structure and then migrate it directly to SQL Azure. Actually you can write a stored procedure in SSMS to do it all in one.
Because CSV file could be tab, comma, or any other character delimited, you can do bulk insert in local DB first as described here and then sync the table to SQL Azure.

how to import access table in my-sql db using ssis as a bridge

I'm just getting into SQL-server 2008 R2 ssis , so forgive me if this is a basic question. I'm building an application using integration service.
Want to create (SSIS) package for importing an MS Access table into My-SQL database.
To create ssis , I don’t want to use Tasks...Import Data .
help me to import access table data to my-sql db.
If have any query plz ask ,thanks in advanced.
1 st you start with defining the connection managers.
You need one for MS Access and one for MySQL (I assume you use MySQL open source db engine as the destination).
Connecting to MySQL may be tricky. I know CozyRock's ODBC connection works with it: http://www.cozyroc.com/ssis/odbc-destination, but you can try creating an ODBC one as described here: http://blogs.msdn.com/b/mattm/archive/2008/03/03/connecting-to-mysql-from-ssis.aspx. Make sure both conn managers connect.
From this point on, drag and drop a new Data Flow Task (DFT).
Inside the add a source and consume your MS Access table, you may need to also add a Derived Column Transformation to convert your incoming columns to some other data types MySQL understands, and finally drag and drop the destination which will employ your MySQL conn. manager. Connect all. Map the columns appropriately and test. If works repeat the aforementioned in a 2nd DFT to cover the import of the other table.

Resources