where # is the seperator between different data in the filename, in .NET i achieved to save the different data in the filename to seperate variables like this
Dim siebelId, accountNumber, docType As String
Dim counter As Integer = 0
Dim sites As String() = Nothing
sites = extension2.Split("#")
Dim s As String
For Each s In sites
If counter = 0 Then
siebelId = s
End If
If counter = 1 Then
accountNumber = s
End If
If counter = 2 Then
docType = s
End If
counter = counter + 1
Next s
How can i achieve this in SSIS where i can save these to variables for later use in an Execute SQL Task ?
Scenario Configuration : VB.net 2005 Code, WebService for Executing SSIS on Server, SSIS deployed on the Database Server
Problem Description : We are developing windows applicaiton in which we call webservice which was deployed on the same server where SSIS packages are deployed. Now from Code we are passing FilePath name in variable and execute the Package. But the SSis result says that The file name "\computernamefol1fol2fol3fol4abc.txt" specified in the connection was not valid.
More Information:
1. Full Permission are given on this network folder. 2. Package executes successfully from SSIS development solution (BIS solution) 3. Deployed packed executes successfully from the Database Server. 4. From Development pc packege executes successfully. 5. Other packages deployed on the same server executed suucessfully with same configuration and scenario.
Only this package is not executing.
-- the only differece with this package with other is -
using ".txt" extension in Flat file connection and using VB Script task
Can any one suggest the appropirate solution for this problem...
the ids are something like this mod01-01 mod02-01 mod03-01 mod01-02 mod02-02 mod03-02 mod03-03 mod03-04 mod04-01 ....
now, i am trying to group by and count all of the ids that end with '01',
i was thinking of something like select count(id) group by id where id= ???
and the second query i need to make is one that counts not one but all the ids that end with the same last 2 digits but in one single query, how can i do that? as a possible hint, is that the only thing i KNOW that the last 2 digits can only be 01,02,03,04 and 05 but still im a bit stuck in here the result should look something like this
id total 01 4 02 3 03 1 04 1
or what suggestions can you give me for this query? even if you just help me with the first query, that would be great, thanks!! thanks!!!
I have a varchar that contains a comma-delimited list of integers, such as "12,34,56,78,123,1,123455".
I need a way to count the number of numbers in the string (or, perhaps, better stated as "I need a count of substrings") ;)
I'm thinking there must be a number of ways to calculate the number of numbers in my list of numbers, but I can only seem to come up with looping through the string/varchar and counting the number of commas, and then adding one to that final count.
Anybody know of a "cooler" way to do this? Everything I can think of involves stepping through a character at a time...
Update [table] Set collumnName = Substring(collumnName, 1, 2) = '11' AND Substring(collumnName, 3, 5) = '00000' Where (conditional statement)
SQL is not letting me perform the update because of the AND statement between the two Substring's. Is there anyway around this...is there anything else I can do to acomplish what I'm trying to do.
Table A(Value), which contains some strings in the column "Value"
Table B(Key,Text), which also contains strings (in the column "Text")
Now I want to find all rows in B which contain at least one string of A and create a result table X with all found rows in B. B should contain the found keys and all found substrings for this key (separated with a comma)
The solution I am looking for may not use a Cursor and may not use the CONTAIN-Statement (fulltextsearch feature)..
If you use "SELECT filename FROM sys.sysdatabases" this will return the full path , such as "E:MSSQLdatamyData.MDF" ,
is it possible to return just the "myData.MDF" part of it? I know that you can parse the string , but is it stored somewhere else , or is there a command that will return just the physical file name ?
Jack Vamvas -------------------- Search IT jobs from multiple sources- http://www.ITjobfeed.com
Hi Guys, got a question that I'm not sure there is an answer to other than 'No Way'.
I have to export a file whose filename must include a sequence number. I have created the table to hold the seq# and the code to increment it. My problem is how do I include the seq# in the output filename. I am using the Flat File Destination tool for exporting. should I be using another tool?
Does anyone know how to execute a directory listing of a file and return the file name to a variable in SQL? For instance, there's a file called c:datach20011010.txt and i execute the following: xp_cmdshell 'dir c:datach*.txt'
or any other transact sql or procedure, how can i get the filename into a variable...all in sql?
FYI - I need to pass a filename to a process so that it can bcp the data into a temp table. But I don't know the filename at the time the process is setup/scheduled.
Hi, I am using a foreach loop to go through the .txt files inside a folder. Using a variable I can pickup the filenames the loop is going through. At present there is a sql task inside the foreach loop which takes the filename as a parameter and passes this filename to a stored procedure. Now I would like to add one extra step before this sql task. Would like to have a dataflow with flatfile source which connects to oledb destination.
The question is: While in the loop, how is it possible to pass the filename to the flatfile source using the FileName variable which I have created?
Please note, this is a different question to my other post.
Hi, I think I may have mis-guided some of you in my previous post. So I thought I explain it properly this time in a new post...
Here is the description of the ssis package:
Inside the connection manager there is a connection to the sql server database and a flat file connection.
The flat file connection inside the connection manager has the expression set i.e. ConnectionString set to @[User::FileName]
And so there is nothing inside the connectionstring property of this flatfile connection.
Inside control flow:
1)
Dataflow which contains a flat file source and an ole db destination
The flatfile source is supposed to pickup the .csv file that gets passed to the ssis package. Then the ole db destination is where the .csv gets imported into a sql server table.
2)
Back in the control flow, there is a task that calls a stored procedure with the parameter which is set to FileName
The question is: How does this FileName parameter gets set before it is passed to the stored procedure?
Hi, Using a ssis package I have several tasks. A variable is also created called FileName. There is a flat file connection called InputFileName. initially when I designed the package, I hardcoded the pass of one of the .csv files into the path of the flatfile connection.
There is a dataflow which has flatfile source and oledb destination. These two basically pickup the file and import into the database using mapping.
So therefore the package works and data gets imported into the database.
Then I used the variable to make the filename dynamic. So I removed the hardcoded connectionstring in the InputFileName.
Is this the right thing to do to make the package dynamic? I would like to pass in any .csv filename and so the package runs. My question is now that the connectionstring is deleted but instead placed an expression for the filename, then how does the system know which file to use?
Hi, I want to get my SSIS package to look for a file in a named directory that has a ceratin string in the filename. example - My file is in a folder called data and the filename is 'System_UT_INCR_BOOKINGHEADER_20080214000000.TXT' Every day the fiel name changes to reflect the current date. I need my package to search for the String "BOOKINGHEADER". I know I need to create a variable with that value but I am not sure (using the example below) how to write the code to do this.
I take a backupfile every night and its named like 20070911_xvall.bak. Now I need a procedure for an automatic restore in another sql server but I have to do a check to se that the date of the backupfile is the same as actual date so it can¨t happened that an older backupfile being restored. Is it a good way to take actual date och build up the wanted filename and how can I then check if the file exist, its stored on another computer? Anyone who has some sample I can start with? Thanks
I have a question regarding the report file which is included in an email, when a subscription is created:
Is it possible to programmatically add something to the name of the created file of the subscription? I want to have one parameter of the report, which is a date, added at the end of the filename to let the clients distinguish between different report files.
i have four text file which comes in different format , one of the fields i need to generate is the source Filename without extension as one of the coloums in the target tables.
The name of the file is requirment in the destination, how could i read the file name of the text file source and make it a coloumn and insert it into target.
How do I correct this error: "The database filename can not contain the following 3 characters: [ (open square brace), ] (close square brace) and ' (single quote)" ? Where is the database stored and/or how can I change the relevant settings? I have Both Visual Web Developer Express and SQL server express. Exception detail: System.Web.HttpException was unhandled by user code Message="The database filename can not contain the following 3 characters: [ (open square brace), ] (close square brace) and ' (single quote)" Source="System.Web" ErrorCode=-2147467259 StackTrace: at System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) at System.Web.DataAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(String connectionString) at System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) at System.Web.Profile.SqlProfileProvider.GetPropertyValuesFromDatabase(String userName, SettingsPropertyValueCollection svc) at System.Web.Profile.SqlProfileProvider.GetPropertyValues(SettingsContext sc, SettingsPropertyCollection properties) at System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider) at System.Configuration.SettingsBase.SetPropertyValueByName(String propertyName, Object propertyValue) at System.Configuration.SettingsBase.set_Item(String propertyName, Object value) at System.Web.Profile.ProfileBase.SetInternal(String propertyName, Object value) at System.Web.Profile.ProfileBase.set_Item(String propertyName, Object value) at System.Web.Profile.ProfileBase.SetPropertyValue(String propertyName, Object propertyValue) at ProfileCommon.set_MyNewProperty(String value) in c:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Fileslesson04385e3cebf08b8b90App_Code.jqcpv0qn.0.cs:line 24 at _Default.Page_Load(Object sender, EventArgs e) in D:Daniel's DocumentsVisual Studio 2005WebSitesLesson04Default.aspx.vb:line 15 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) Thanks in advance
how can I store a filename in the database, i have some GIF files which i want to show up on report, how can i specify those filename with a path in the database. i tried manually entering the path c:Dataimages.gif but it didnt work. Can someone pls tell me how to do it.
I have a page called 'upload.vb', which is the code for a file upload project I am working on. I am trying to write the filenames to an SQL database that I have built, but I keep getting this error: Compiler Error Message: BC30201: Expression expected. It doesn't seem to like the @ on line 46 in the VALUES part of my INSERT statement. Can anybody shed any light on this. Thanks. 1 Imports System 2 Imports System.Data 3 Imports System.Configuration 4 Imports System.Web 5 Imports System.Web.Security 6 Imports System.Web.UI 7 Imports System.Web.UI.WebControls 8 Imports System.Web.UI.WebControls.WebParts 9 Imports System.Web.UI.HtmlControls 10 Imports System.IO 11 Imports System.Data.SqlClient 12 13 ''' <summary> 14 ''' Upload handler for uploading files. 15 ''' </summary> 16 Public Class Upload 17 Implements IHttpHandler, IReadOnlySessionState 18 19 Public Sub New() 20 End Sub 21 22 #Region "IHttpHandler Members" 23 24 Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable 25 Get 26 Return True 27 End Get 28 End Property 29 30 31 32 Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest 33 34 If context.Request.Files.Count > 0 Then 35 ' get the applications path 36 Dim tempFile As String = context.Request.PhysicalApplicationPath 37 ' loop through all the uploaded files 38 Dim j As Integer = 0 39 While j < context.Request.Files.Count 40 ' get the current file 41 Dim uploadFile As HttpPostedFile = context.Request.Files(j) 42 ' if there was a file uploded 43 If uploadFile.ContentLength > 0 Then 44 45 uploadFile.SaveAs(String.Format("{0}{1}{2}", tempFile, "Uploads", uploadFile.FileName)) 46 SqlDataSource.InsertCommand = "INSERT INTO tblDocuments(TheFileName) VALUES ('" & @TheFileName & "')" 47 48 End If 49 System.Math.Max(System.Threading.Interlocked.Increment(j), j - 1) 50 End While 51 End If 52 ' Used as a fix for a bug in mac flash player that makes the 53 ' onComplete event not fire 54 HttpContext.Current.Response.Write(" ") 55 End Sub 56 #End Region 57 58 End Class
Hi, I have inherited a database that has a table called "Resources" that contains a field called "FilePath". FilePath is a VarChar(100) and contains the server path and filename of an XML file on the server hard disk. I need to join the data in the XML with rows in the "Resources" table (and other tables). Is it possible to get a Stored Procedure to load the XML file into a temporary table? Is loading it into a table the best way to do it - or can I join directly to the XML file somehow? What is the best approach? (I know nothing about XML in SQL Server yet) Thanks in advance, Chiz.
Basically like the topic says, I need to populate a filename with data from other columns and im having a tough time doing it.
Code:
UPDATE nice_cls_calls_0027 SET vcarchivepath = 'G:Nice Storageicestorage.safeautonet.netSafe Auto Task - Logger (807101)2006_feb_1SC_807101_'start_time'_'=stop_time'_'=channel'_'=cls_call_id'.aud'
I need start_time, stop_time, channel, and cls_call_id to populate the filename. The first 2 are datetime fields in the db and no conversion is needed for them, just raw data. The remaining two are smallint and raw data is needed there also. Any help would be greatly appreciated. TY
I need to use DTS to create a dynamic destination filename based on the value of a field. I tried creating a DTS package using the wizard. It works fine if I wanted a static filename for the destination filename. I tried creating a Dynamic Properties Task by selecting Connection2/OLEDB Properties/Data Source and then using a SQL Statement to return a value for the name of the file. It doesn't seem to run the query everytime the DTS is ran. The first time I run it it names the file correctly but after that it keeps naming the file the old value from the SQL statement. Any idea what I need to do to fix this?
I have to extract only the filename from the below filepath.
The first part prodserverexport always remains the same. A new folder is created prodserverexport 20071001, prodserverexport 200710012 etc each time the file is dropped . I want to extract only the part after that namely 20071001-200001-e430f8fd-PREC272.wma and like wise and dump it into a table.