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
 General SQL Server Forums
 New to SQL Server Programming
 Dynamic Import from text file

Author  Topic 

spareus
Yak Posting Veteran

52 Posts

Posted - 2010-02-02 : 08:33:46
I have SQL 2000.
I have saved a DTS package for importing data from text files.
Problem is that DTS package always refer to the same file.

Is there a way so that when I run the package, it will ask me to choose a file to import?

Regards,
Spareus.


Regards,
Spareus

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-02 : 09:25:23
see

http://www.sqlservercentral.com/articles/DTS/importingthelatestfileinafolderviadts/1829/
Go to Top of Page

spareus
Yak Posting Veteran

52 Posts

Posted - 2010-02-03 : 05:29:00
Thanks for reply.
But I need to different file each time instead of the latest file.
Rest of the operation will be same as destination table, field mapping etc.


Regards,
Spareus
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-03 : 06:19:09
quote:
Originally posted by spareus

Thanks for reply.
But I need to different file each time instead of the latest file.
Rest of the operation will be same as destination table, field mapping etc.


Regards,
Spareus


cant you apply same logic? just look for file with greatest value of last modified date
Go to Top of Page

spareus
Yak Posting Veteran

52 Posts

Posted - 2010-02-03 : 06:37:25
No.
I have to select the file from differernt locations which might not be the latest.




Regards,
Spareus
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-03 : 06:50:50
quote:
Originally posted by spareus

No.
I have to select the file from differernt locations which might not be the latest.




Regards,
Spareus


ok in that case is it possible for you to save that info in some sql table? create a global variable in table and save value against it. then in dts add a step to get global variable values and using dynamic properties task map them to file source property.
Go to Top of Page

spareus
Yak Posting Veteran

52 Posts

Posted - 2010-02-03 : 07:04:04
Well sir, I am quite new in to all this. I am not known to Such advance programming.
Now since every time file name and location changes, I have to manually import the file by wizard or copy/paste file to predefined location and run saved package. and there are many files so I want to save my time by automating it.

Can something be done by using quary analyser?

Thanks again for all your help.



Regards,
Spareus
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-03 : 07:07:46
quote:
Originally posted by spareus

Well sir, I am quite new in to all this. I am not known to Such advance programming.
Now since every time file name and location changes, I have to manually import the file by wizard or copy/paste file to predefined location and run saved package. and there are many files so I want to save my time by automating it.

Can something be done by using quary analyser?

Thanks again for all your help.



Regards,
Spareus


even in that case you can apply last suggestion provided you store location as well as file name as values of global variable in a config table and use it
Go to Top of Page

spareus
Yak Posting Veteran

52 Posts

Posted - 2010-02-03 : 07:20:26
If thats possible, may I request you to pl let me know the how can I do that.
Pl help me with step by step actions to be taken by me.




Regards,
Spareus
Go to Top of Page

spareus
Yak Posting Veteran

52 Posts

Posted - 2010-02-08 : 06:16:32
Pl help.


Regards,
Spareus
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-02-10 : 06:32:26
Whay dont you try this?
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -