August 14, 2007 at 1:56 pm
Hi my boss has asked me to import a data from a excel sheet to a table in sqlserver .
the exact task given by him is as follows:
He wants me to back up the current table and delete all rows from the table and import the data from the excel file to the table and validate it.
My questions are :
1..How to back up a single table in a database?
2..How to import the data from the excel sheet into the sqlserver table?
We are using sqlserver 2005
Ihave to finish this task as early as possible can any body help me with this?
Please its really urgent
Thanks in advance
Pavan Posani
August 14, 2007 at 2:13 pm
my god,
1..How to back up a single table in a database?
simple way: select * into temptable from whatevertablename
2..How to import the data from the excel sheet into the sqlserver table?
use import / export function, it exists in 2000/2005 and many other DB
August 14, 2007 at 2:18 pm
Short and sweet...
Make new DB
SELECT * INTO NewDB.dbo.TblName FROM dbo.CurrentTbl
Backup new databse
Backup currentdb
DELETE dbo.CurrentTbl
Import
August 14, 2007 at 2:39 pm
Based on your questions, confirm that you have the table (and DATA) well backed up before you do any deleting or truncating.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply