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.
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 cardsHere 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 MVPhttp://visakhm.blogspot.com/ |
|
|
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.csvor name 201207220106.csvor name 201207220205.csvi want to make the last 4 numbers before the .csv be wildcards in my connection string. |
|
|
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.csvor name 201207220106.csvor name 201207220205.csvi 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 MVPhttp://visakhm.blogspot.com/ |
|
|
pavlos
Yak Posting Veteran
59 Posts |
Posted - 2012-07-23 : 23:46:06
|
for each loop was the correct way to go!thanks! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-24 : 00:11:42
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|