![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
-----Original Message----- Hi, I'm trying to use DTS to solve the following mess: 1) I have 120 excel spreadsheets/day 2) I run 120 macros on these excel spreadsheets - the macro does the following: 1) Inserts three columns 2) Enters in data: server, date, time. These are all the same for a given spreadsheet. 3) Then I use BCP to import into SQL tables. I was shown DTS. And it looks great. Except I cannot figure how to do some preprocessingon my csv. I'd love to have something add three columns, insert the data. Could this be done like my excel macros? Prompt for the server, date, time for each file, then away it goes? It would save me hours. Thanks in advance! . |
#3
| |||
| |||
|
|
-----Original Message----- In article <085b01c34001$423c2a10$a101280a (AT) phx (DOT) gbl>, Edgardo Valdez edgardovaldez (AT) hotmail (DOT) com> writes I would load the files using DTS and then add the columns usin the data recently loaded. For instance: 1-. Load the file to a table call temp 2-. Populate the destination table with: insert into destination table select *, [server], [date], [time] from temp In this case I don't see the staging table really adds anything, apart from a larger log. Import the file straight into the final table with the three extra columns. You could easily add an ActiveX Script Transform that reads the three values from global variables. I would populate the global variables in advance using an ActiveX Script Task where you can easily derive the date, time and even the server name via the scripting object. ActX may be slower than copy column but then at least it is a single stage process, but testing is the only way to really prove this. -- Darren Green (SQL Server MVP) DTS - http://www.sqldts.com . |
#4
| |||
| |||
|
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Ok, I posted a follow up that I got this working. And now I can dynamically change the file name. Very fun. Now the icing on the cake would be: Scroll through this directory and for every file named X, run this package. I'm going to do a little research, it shouldn't be too hard, right? Thanks everyone! |
![]() |
| Thread Tools | |
| Display Modes | |
| |