Solved

Overwrite SQL table

Posted on 2010-09-09
7
592 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 250 total points
ID: 33636339
delete from table;
insert into table select column1, column2 from newTable;
0
Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

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…
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

696 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