Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Excel to table using DTS

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-03-08 : 08:52:38
Hvr writes "Hi all,
I transfered excel data into SQL table using DTS.After that i wrote a procedure to filter and update some rows .
My Excel file name changes every month.(all excels in one share folder)
Now my questions are

1) What is the standard procedure to select the excel file based on month automatically.
(if we give standard name to excel file. what is the script to be written? note: i have a date column in excel which tell the month details. I heard that by creating Global variables and sending month as a parameter. )

plz provide steps to follow (where to create Globalvar,what is the script which will take excel file based on month , where to put this script. ) as iam new to sqlserver.

2)How to incremental update the new month data to my existing table.(one way is to clear everything in table and add total data (two months) data.)

3)plz provide sites where can i find info on various scripts"

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2006-03-08 : 10:19:38
Why not just rename your Excel file to something else before running it into SQL?

Something like:

declare @cmd as varchar(100)

set @cmd = 'copy bla*' + convert(varchar(2),month(getdate())) + convert(varchar,year(getdate())) + '.xls blabla.xls'

xp_cmdshell @cmd
Go to Top of Page
   

- Advertisement -