• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 638
  • Last Modified:

Overwrite SQL table

Hello,

I'm new to the SQL world.  I have a table in a SQL database with 2 columns containing about 4000 records, which needs to be overwritten with a new set of 4000 records.  How can i easily achieve this?
0
PLA_LTM
Asked:
PLA_LTM
  • 2
  • 2
  • 2
  • +1
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
where does the data come from?
0
 
PLA_LTMAuthor Commented:
I have an excel sheet that currently has this info.

Ideally, is there a way to have my SQL table merely reference this excel sheet??  So that, in the future, if we make changes the table will update automatically?

0
 
movendraCommented:
delete from table;
insert into table select column1, column2 from newTable;
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Raja Jegan RSQL Server DBA & ArchitectCommented:
Yes, Just create that Excel file as a linked server in SQL Server.
Once done, all changes done in the Excel sheet can be directly references from SQL Server as a table or view as required.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>Ideally, is there a way to have my SQL table merely reference this excel sheet??

actually, ideally would be to have the sql table be the reference, and the excel sheet update from the sql table? after all, sql is the database system, not excel ... no?

apart from that... with SSIS, you can import/export from/to table<--->excel ...
please check that out
0
 
movendraCommented:
NO, you can't "link" a SQL table to an excel datasheet. If you need to automate import you'll better save data in a text file ( CSV ) and then import with a BULK INSERT statement. Excel is not a good choice for a data source. I always had many problems with it. What kind of data do you have to import ? ( string, numeric, datetime, .... )
0
 
PLA_LTMAuthor Commented:
Thanks for the advise.  I ended up deleting the table and adding a new.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now