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 2008 Forums
 SSIS and Import/Export (2008)
 connection string.. wild card for hour and minute

Author  Topic 

pavlos
Yak Posting Veteran

59 Posts

Posted - 2012-07-22 : 22:58:41
hey guys,
I have setup a connection stirng which returns the following
//server/name 20120722hhmm.csv (this is yesterdays date)

I want to replace the hhmm with wild cards

Here is my code:
@[User::ServerPath] + "name "
+
(DT_STR,4,1252) DatePart("yyyy",DATEADD("day", -1, GETDATE()))
+
Right("0" + (DT_STR,4,1252) DatePart("m",DATEADD("day", -1, GETDATE())),2)
+
Right("0" + (DT_STR,4,1252) DatePart("d",DATEADD("day", -1, GETDATE())),2)
+
"hhmm"
+
".csv"

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-23 : 00:52:36
do you mean this?

@[User::ServerPath] + "name " + REPLACE((DT_WSTR, 20) (DT_DBDATE) @[System::StartTime],"-", "") + "%.csv"

Can you explain what you're trying to do with this?
------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

pavlos
Yak Posting Veteran

59 Posts

Posted - 2012-07-23 : 02:41:53
i need to define a strong connection to a csv.

the csv will always be
name 201207220103.csv
or name 201207220106.csv
or name 201207220205.csv

i want to make the last 4 numbers before the .csv be wildcards in my connection string.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-23 : 10:45:50
quote:
Originally posted by pavlos

i need to define a strong connection to a csv.

the csv will always be
name 201207220103.csv
or name 201207220106.csv
or name 201207220205.csv

i want to make the last 4 numbers before the .csv be wildcards in my connection string.



you dont need to do that. you are trying to iterate over set of files? for that its enough to use for each loop and no need of wildcard connection string.
it wont work with wildcard connection string

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

pavlos
Yak Posting Veteran

59 Posts

Posted - 2012-07-23 : 23:46:06
for each loop was the correct way to go!
thanks!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-24 : 00:11:42
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -