Inserting data from XLS & CSV to SQL DB

  • I have several csv & xls files full of data.

    I need to insert the data into relavite tables:

    XLS --> Table 1

    XLS --> Table 2

    CSV --> Table 3

    CSV --> Table 4

    I dont need anything special done with the data, just a standard import.

    Whats the best way to do this?

    Thanks

  • Easiest way is to use the Import / Export wizard in SSMS

  • Thanks,

    I used the Import wizard... looks like it has worked...well 50/50

    Its created a table called 'File-Name-Of-My-ExcelFile$'

    And in the same format as above i.e. including the - & $

    When I do a select from that table it comes back with incorrect syntax near 'File-Name_Of-My-ExcelFile$'

    But if I right click on the table and select 'Open Table' i can see the data but its grayed out...

  • You should probably rename the table to something a bit more useful in the import process.

    But too select from your current table enclose the table name in []

    select * from [File-Name-Of-My-ExcelFile$]

  • Thanks, the [] worked.

    I cant seem to rename the CREATE TABLE bit in my SSIS...

    Once I run the first set to create the table with new name.."tblTransaction".

    I run the insert part of the SSIS.

    When I then run a select against my new table "tblTransaction"

    i get the same error, Invalid object name 'dbo.tbltransaction'.....

  • glad it worked.

    check in SSMS that it has created the table in the correct database, if you see this new table in the explorer then you will be able to select from it..

  • Its is very strange!!!!!

    I can see, edit, open the table but i cant run a select against it!

    :crazy:

  • A Little Help Please (4/23/2009)


    Its is very strange!!!!!

    I can see, edit, open the table but i cant run a select against it!

    :crazy:

    Are you sure you are running the select against the right database...

    trying using...

    USE YourDatabase

    at the top of the select statement.

    Though this seems obvious it sometimes traps me..

  • Ok I think i found out why, it was using spaces between the names.... I duno... either way its select is working now.

    Thanks for your help!!!!!!!!!!!!!!!!!!!!!!

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply