0

I have table data in a sheet of xls. I need to 'update' this data into a table in SQL DB.

Note:

  1. The xls will contain only the columns that will undergo change. (for example if only two columns will undergo changes, then only those two columns for all the records will be present in the xls)

  2. The primary key column will be present in xls for reference.

Please help me in solving this.

1
  • SQL being "Microsoft SQL Server", or what database system do you mean?? SQL is just a querying language - not a product.... Commented Dec 1, 2010 at 9:52

1 Answer 1

2

If this is a one-off load then it is pretty easy to turn the data into SQL statements. Say your sheet has two columns (A & B) then you could put the following formula in column C:

"update tablename set somecol=" & B1 & " where keycol=" & A1

(sorting out quotes for strings, etc as appropriate)

Next just copy the formula down to the bottom, then copy all cells in col C, paste into a text editor and run into your SQL tool.

If you need to hand this over to users or run frequently then there are many, many ways to do this and it really depends on the tools at your disposal (Java, C#, ...)

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.