Excel to SQL help

db , sql server United States
  • 11 years ago

     Hello i am trying to write a query in SQL that will take specific fields from an excel spreadsheet and insert them into a sql database, based on two criteria being equal. i am not sure if i can even do this, and im not sure where (or how ) i would tell it to look for the excel table. i would code by hand, but then i would have to touch 70k of tables.

    here is how  i think it should look, but i know i am missing pieces of it.
     

    Update master m

    Set m.prodcl = prodcl.xls

    Where m.partno = partno.xls

    And m.revno= revno.xls

     I am a little lost to say the least
     

     

  • 11 years ago

    How about adding the excel spreadsheet as a linked server which would then allow you to query it using TSQL? 

    http://msdn.microsoft.com/en-us/library/ms190479.aspx

    Tim 

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Linux is only free if your time has no value” - Jamie Zawinski