0

Say I have thousands of Excel files with all people's information.

Name Height
John  182
Sam   178
...

If I want to import these data into a new MS-SQL database table using SQL query, how should I do that?

Name  Weights
John  130
Sam   160
...

And now if I want to append 'Weights' data into previous table using query, how should I do that?

The reason I'm doing this is because import too much Excel using wizard can lead to a huge waste of time, so I'm thinking if I can embed SQL query in MATLAB, then a for loop will do the job for me, hopefully.

Thank you in advance.

1 Answer 1

1

you can use OPENROWSET to import from excel into table

example :

INSERT INTO yourtable ( . . . )
SELECT  . . . 
FROM    OPENROWSET('Microsoft.ACE.OLEDB.12.0',
        'Excel 12.0;Database=C:\EXCEL\ExcelFile.xlsx', 
        'SELECT * FROM [Sheet1$]')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.