?
Solved

Overwrite SQL table

Posted on 2010-09-09
7
Medium Priority
?
593 Views
Last Modified: 2012-05-10
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
Comment
Question by:PLA_LTM
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 33636302
where does the data come from?
0
 

Author Comment

by:PLA_LTM
ID: 33636331
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
 
LVL 1

Accepted Solution

by:
movendra earned 750 total points
ID: 33636339
delete from table;
insert into table select column1, column2 from newTable;
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 33636370
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
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 33636386
>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
 
LVL 1

Expert Comment

by:movendra
ID: 33636438
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
 

Author Closing Comment

by:PLA_LTM
ID: 33640414
Thanks for the advise.  I ended up deleting the table and adding a new.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question