Showing posts with label plan. Show all posts
Showing posts with label plan. Show all posts

Wednesday, March 21, 2012

Import Excel file into SQL Server

Could someone provide me with a URL that explains how to set up DTS to import an Excel file into SQL Server?

I plan to run this infrequently so there is no need to schedule a recurring run.

Thanks,
CraigHere is sample how to get rows from Excel file in SQL - use OPENDATASOURCE:

select * from OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source="\\comp\share name\filename.xls";Extended Properties=Excel 8.0')...['2005$']

where ['2005$'] is Sheet name in Excel (2005).
Format ['name$'] uses only for sheets started with digit or contained spaces.
overwise:
Sheet1$ for sheet with name Sheet1|||Thanks for the reply. I will try that.

If I can get it imported, can I include it as a temp table in queries and would I need a linked server for that?

Craig

Friday, March 9, 2012

import data

I'm basically a database noob hoping to find a shortcut if at all possible.

I've created an ER diagram for a site I plan to build and have used that to
create the database in MS SQL 2000.

Now I want to import various data from (basically) excel spreadsheets (for
example, company names from a different sql dbase, addresses from excel and
phone numbers from a csv file) into the new database.

I have tried various methods outlined on web sites (including DTS) and have
learned I need to go back and create default values for essentially every
non-null field if I am to update literally any linked table.

My question is this: Is there any easy way/program via which I can import
the data to two different tables -- i.e. address into one table and
corresponding city into another table -- and have the relationship(s)
continue?

Or alternatively is there a "better/easy" way to do it inside sql once I
import the entire data into it's own single table?

Not to belabor the point (versus to more fully explain), but say I have two
data sets

[ Company Name | Address ]

and

[ Company Name | Phone ]

and I want to import them both into a database with separate three tables:

1. Company Name
2. Address
3. Phone

What is the least labour intensive way to effect this??

Thanks in advanceAlso, (though it is the same issue essentially) what if the first
dataset is Company Name, Address, City where each different city is
listed from 1 to ? number of times -- is there a way the dbase can
know that say New York only needs to be added once to a City table and
then the other tables just have a reference to that ID in the city
table?

"Mark S" <bob@.bob.comwrote in message
news:GVc_h.156992$aG1.70770@.pd7urf3no...

Quote:

Originally Posted by

I'm basically a database noob hoping to find a shortcut if at all
possible.
>
I've created an ER diagram for a site I plan to build and have used that
to create the database in MS SQL 2000.
>
Now I want to import various data from (basically) excel spreadsheets (for
example, company names from a different sql dbase, addresses from excel
and phone numbers from a csv file) into the new database.
>
I have tried various methods outlined on web sites (including DTS) and
have learned I need to go back and create default values for essentially
every non-null field if I am to update literally any linked table.
>
My question is this: Is there any easy way/program via which I can import
the data to two different tables -- i.e. address into one table and
corresponding city into another table -- and have the relationship(s)
continue?
>
Or alternatively is there a "better/easy" way to do it inside sql once I
import the entire data into it's own single table?
>
>
>
Not to belabor the point (versus to more fully explain), but say I have
two data sets
>
[ Company Name | Address ]
>
and
>
[ Company Name | Phone ]
>
and I want to import them both into a database with separate three tables:
>
1. Company Name
2. Address
3. Phone
>
What is the least labour intensive way to effect this??
>
Thanks in advance
>
>
>

|||Mark S wrote:

Quote:

Originally Posted by

Not to belabor the point (versus to more fully explain), but say I have two
data sets
>
[ Company Name | Address ]
>
and
>
[ Company Name | Phone ]
>
and I want to import them both into a database with separate three tables:
>
1. Company Name
2. Address
3. Phone
>
What is the least labour intensive way to effect this??


I would create a table with columns (name, address, phone), import
into it, then use queries to copy its data to the other tables.

Wednesday, March 7, 2012

Import and Export SQL 2005 Maintenance Plan

I had created a maintenance plan and configure and scheduled my maintenace plan to run. I would like to save this package as a file into a source control. SO I use SSIS to export the package under stored packages->MSDB->Maintenace Plan. After that, I wanted to test my import process. So I deleted the packages under SSIS ->stored packages->MSDB->Maintenance plan and I use the import to add the package from my previously exported package stored in a file .dtxs extention.

So the problem is, after I imported my package. I lost the configured schedule and the job runs without doing anything. When I try to go in and make changes to the package, by adding a new schedule under SQL server -> management->maintenance plan. I receive a odd error message and it doesn't allow me to save the package.. The error message I got is...."GUID should contain 32 digits with 4 dashes (xxxxx-xxx-xx...)"

So my questions are: 1. why did the re-import loses the originally configure job run schedule. 2. why doesn't the re-import package works by backing up database as it was first setup. 3. why I cannot re-edit this package and saving the package error out?

Thank you for reading and for your helps! --Jon

I hope this should help. I have the same problem and working out on it

http://support.microsoft.com/default.aspx/kb/922651

http://sqlug.be/blogs/drivenbysql/archive/2006/10/21/374.aspx

|||I had similar issues. SSIS wasn't installed first, so I installed it then starting to get that GUID error. It was a simple fix actually. In studio, got to SQL Server Agent, Jobs and it had jobs for all my deleted plans. I cleared out the jobs, then created a brand new plan and it worked fine. I guess the errors created when I tried to create a plan prior to the SSIS installation caused it not to clear the jobs.

Though, this may or may not be what happened to you.

Import and Export SQL 2005 Maintenance Plan

I had created a maintenance plan and configure and scheduled my maintenace plan to run. I would like to save this package as a file into a source control. SO I use SSIS to export the package under stored packages->MSDB->Maintenace Plan. After that, I wanted to test my import process. So I deleted the packages under SSIS ->stored packages->MSDB->Maintenance plan and I use the import to add the package from my previously exported package stored in a file .dtxs extention.

So the problem is, after I imported my package. I lost the configured schedule and the job runs without doing anything. When I try to go in and make changes to the package, by adding a new schedule under SQL server -> management->maintenance plan. I receive a odd error message and it doesn't allow me to save the package.. The error message I got is...."GUID should contain 32 digits with 4 dashes (xxxxx-xxx-xx...)"

So my questions are: 1. why did the re-import loses the originally configure job run schedule. 2. why doesn't the re-import package works by backing up database as it was first setup. 3. why I cannot re-edit this package and saving the package error out?

Thank you for reading and for your helps! --Jon

I hope this should help. I have the same problem and working out on it

http://support.microsoft.com/default.aspx/kb/922651

http://sqlug.be/blogs/drivenbysql/archive/2006/10/21/374.aspx

|||I had similar issues. SSIS wasn't installed first, so I installed it then starting to get that GUID error. It was a simple fix actually. In studio, got to SQL Server Agent, Jobs and it had jobs for all my deleted plans. I cleared out the jobs, then created a brand new plan and it worked fine. I guess the errors created when I tried to create a plan prior to the SSIS installation caused it not to clear the jobs.

Though, this may or may not be what happened to you.