Accessing Properties Of A ScriptTask
Aug 2, 2007
I have a ScriptTask, in the designer I've given it a name. Is there a way at runtime to pick up that name from within the code in the ScriptTask?
I have a ScriptTask, in the designer I've given it a name. Is there a way at runtime to pick up that name from within the code in the ScriptTask?
Hi All,
In one of my ScriptTasks, I instantiate FileSystemWatcher class and set events for it. This has been done inside the Main() method. I can access all the varibles declared in the SSIS package inside the Main() method (by using Dts.Variables("").Value) but none can be accessed inside the event methods. One possible reason for this can be, events might be running in different threads.
Now my question is, How the varibles can be accessed inside the event methods.
Hope someone can give me a solution. Appricate all your solutions.
Thanks
I am attempting to set my custom properties in the UI I have created for my custom transformation. I can access them in the ProcessInput, but if I try to assign them a new value in my UI the values dont change.
I set the properties up in ProvideComponentProperties
public override void ProvideComponentProperties()
{
// Perform component setup operations
ComponentMetaData.UsesDispositions = false;
// Add Input
IDTSInput90 input = ComponentMetaData.InputCollection.New();
input.Name = "TrimInput";
input.ErrorRowDisposition = DTSRowDisposition.RD_NotUsed;
// Add Output
IDTSOutput90 output = ComponentMetaData.OutputCollection.New();
output.Name = "TrimOutput";
output.SynchronousInputID = input.ID;
IDTSCustomProperty90 Trimproperty = ComponentMetaData.CustomPropertyCollection.New();
Trimproperty.Name = "Trim Values";
Trimproperty.Description = "Selected Trim Values";
IDTSCustomProperty90 Colproperty = ComponentMetaData.CustomPropertyCollection.New();
Colproperty.Name = "Col Names";
Colproperty.Description = "Column Names";
}
btn Click event in UI form
IDTSCustomProperty90 Trimproperty = _dtsComponentMetaData.CustomPropertyCollection["Trim Values"];
Trimproperty.Value = sConcatTrim;
IDTSCustomProperty90 Colproperty = _dtsComponentMetaData.CustomPropertyCollection["Col Names"];
Colproperty.Value = sConcatColNames;
Any suggestions or please point me to any example would be greatly appreciated.
Hi all,I have an existing application that checks a few things before itlaunches another application. One thing that the application needs tocheck is the subscription properties of both the local database and theremote (LAN) server.I've stumbled upon some properties but I am trying to fit in the lastones and I can't seem to find the right code to accomplish this... Cananyone shine a little light on this please ?The following code queries the SQL Server (remote) to get (some of) theproperties of the replicated database. What I would like to fit inafter the 'state' are the properties that you can retrieve with theEnumAllSubscriptions function. However, I can't seem to find the rightobject (sample code) to retrieve those (or I'm just overlooking theobvious)...Here is (part of) the code I'm using to query the publication on theremote server :Dim oMergePublication As SQLDMO.MergePublication2Dim oSubscription As SQLDMO.MergeSubscription2Me.lstPublications.ClearFor Each oReplicationDatabase InobjSQLSERVER.Replication.ReplicationDatabasesIf oReplicationDatabase.Name = Me.txtSQLServerDatabase.TextThenFor Each oMergePublication InoReplicationDatabase.MergePublicationsbFoundReplicated = TrueMe.lstPublications.AddItem "Database replicated as'" & oMergePublication.Name & "'"For Each oSubscription InoMergePublication.MergeSubscriptionsMe.lstPublications.AddItem " - subscriber:" & oSubscription.SubscriberMe.lstPublications.AddItem " - localDB :" & oSubscription.SubscriptionDBMe.lstPublications.AddItem " -state :" & GetReplStatus(oSubscription.Status)NextNext'For Each osubscriber In oReplicationDatabase.'NextEnd IfNextSet oReplicationDatabase = NothingSet oMergePublication = NothingAfter this, I also want to check the local DB (=pulled subscription)and show some of the properties (from EnumAllSubscriptions). Forexample to warn the user about the need to synchronise (last_updatedvalue)...Any help appreciated,Many thanksGB--Your eyes are weary from staring at the CRT. You feel sleepy. Noticehow restful it is to watch the cursor blink. Close your eyes. Theopinions stated above are yours. When I snap my fingers, you cannotimagine why you ever felt otherwise. <snap>
View 2 Replies View RelatedI have an ODBC connection string that is working fine with the following properties:
Database="XXXXXXX",Network="YYYYYY"; strangely no server is specified in the string, but it is specified in the ODBC Connection file.
I am trying to do a new server registration in SSMS for this database.However, I don't understand where the network spec is placed.
Under Registered server name I've tried:
YYYYYYXXXXX
When I browse the server for the database instance list, I receive "network path was not found".
I even tried:"XXXXXXX",Network="YYYYYY" for the registered server name.Same error message.
What am I doing wrong ?
Hi,
I have the following flow in which i am looping through a folder containing textfiles
Foreach loop
[
ScriptTask -> DataFlowTask -> Execute SQL
]
In my ScriptTask, i am checking the file validity. Now if the file is found incorrect, I do not want the DataFlowTask and other to execute. Instead i want the file to be moved to Error and the loop to proceed with the next file. If the file validity is correct, DFT and ExecuteSQL execute. How do i do this?
Some explanation supported by examples would help.
Lalit
Hi guys,
I have a column value like MPROW0016
M is for monthly/yearly
PRO 3 character make account type of the sub
W is web
0016 - id
here i neet to split this COLUMN USING SCRIPT TASK IN SSIS
plz help me how to do this .
I have a feeling I'm overlooking something painfully simple here. Inside a Script Task, I'm trying to fill a DataTable with a recordset variable.
oledbAdapter.Fill(dataTable, Dts.Variables("rsSrcTblNames"))
...doesn't work, because Dts.Variables("rsSrcTblNames") is a System.Object, not an ADODB recordset. Sure, whatever. Most of the examples I see online use Me.Variables.rsSrcTblNames, as in:
oledbAdapter.Fill(dataTable, Me.Variables.rsSrcTblNames)
That also doesn't work, which makes less sense to me. The auto-correct highlights "Me.Variables", giving the message "'Variables' is not a member of ScriptTask_34dgf89sghg9a8h...". I guess this makes sense given that I'm in a Script Task, and apparently the syntax I'm trying to use is for Script Components (http://msdn2.microsoft.com/en-us/library/ms136031.aspx). But I'm at a loss how to proceed. Any suggestions would be appreciated.
(more detailed description of situation and code will be posted below)
I'm building packages programmatically. I need to add a ScriptTask to my package and include the script code. The script task itself is easy to add. But I can't figure out how to add the script code to the task.
I found one post in this forum saying the trick is to use the PutSourceCode method of the StriptTaskCodeProvider class, but I can't figure out how to do that.
Can anyone provide a code sample of how this is done?
Thanks.
Hi. I've tried several things to log some information inside of the ScriptTask. I've tried Console.WriteLine(), Debug.WriteLine(), and Dts.Log().
All compile and work, but my problem is I can't find the output to save my life.
I have logging turned on in my SSIS package, but the data doesn't show up in that file. I've check SQL Server's log. Event Log in OS. All no luck.
Please help.
I want to loop thru all the variables in my package and set number of variables that had variable-name begin w/LOCAL, so I can use the name to generate a dynamic SQL query for the next EXEC SQL Task. any one know how to do this.
Hi am trying without luck to load a package which contains a ScriptTask and read the source code of that task.
I can load the package and get the ScriptTask no problem.
However i am not sure how to get the source code.
I know i have to use the ScriptTaskCodeProvider and i assume the GetSourceCode() method.
This is what i have so far
ScriptTask scriptTask = taskHost.InnerObject as ScriptTask;
ScriptTaskCodeProvider codeProvider = new ScriptTaskCodeProvider();
codeProvider.LoadFromTask(scriptTask);
string sourceCode = codeProvider.GetSourceCode(scriptTask.VsaProjectName);
Any assistance greatly appreciated.
Cheers
Richard.
I have created a task that uses a ForEachFile Loop. Within that loop I load 5 files. Once those 5 files have loaded successfully I want to run a stored procedure. I placed this stored procedure into a script task. The script task has 5 precedence constraints,. They are a success on the load of the files. When I run the task, the 5 files load, but the script task will not start. I have gone so far as to check each load individually to see if it would start the script task, which they do. It's only when I add more than 1 precedence constraint that the script task will not run. The precedence constraints are set to AND, so they all are required. They all succeed. What am I doing wrong?
View 3 Replies View RelatedI need a library for Microsoft.SqlServer.Dts.Tasks.ScriptTask. How do I go about getting this.
Basically I am trying to execute the following code to verify my SSIS ran correctly.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.ScriptTask;
namespace Package_API
{
class Program
{
static void Main(string[] args)
{
Package p = new Package();
p.InteractiveMode = true;
p.OfflineMode = true;
// Add a Script Task to the package.
TaskHost taskH = (TaskHost)p.Executables.Add("STOCK : ScriptTask");
// Run the package.
p.Execute();
// Review the results of the run.
if (taskH.ExecutionResult == DTSExecResult.Failure || taskH.ExecutionStatus == DTSExecStatus.Abend)
Console.WriteLine("Task failed or abended");
else
Console.WriteLine("Task ran successfully");
}
}
}
Hi,
I developed an SSIS package in which i declared a global variable"FileName" . In script task of SSIS I am assigning some value to that global variable"FileName".
Now, In script page of "ScriptTaskEditor" either I declare global variable"FileName" as ReadOnlyVariable or as ReadWriteVariable, In both conditions i am able to get the new assigned value from global variable"FileName".
So, my question is that, Here what is the difference between "ReadOnlyVariable " and "ReadWriteVariable", since i am
getting result from both and what declaration should I use ?
Code line is:
Dts.Variables("FileName").Value().ToString = "LatestFile"
I have been developing a large SSIS project and it uses scripts extensively.
During development, i encountered no problems.
However, when i tried executing them on a server (windows server 2003), i was given this error for all the scripts:
Here is a brief log:
PackageStart,servername,networklogin,PkgName,{A6778813-1F3A-4133-A00C-6F02AC8CC8B1},{EA6E6337-8C07-428D-9E3B-CEEB4F95A185},3/10/2006 5:24:26 PM,3/10/2006 5:24:26 PM,0,0x,Beginning of package execution.
OnError,servername,networklogin,PkgName,Rename Error Files,{8d38e1b7-44e8-419e-963e-c689edd0be2c},{EA6E6337-8C07-428D-9E3B-CEEB4F95A185},3/10/2006 5:24:30 PM,3/10/2006 5:24:30 PM,7,0x,Error 30456: 'Variables' is not a member of 'Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel'.
Line 26 Columns 51-63
Line Text: Dim DaysToKeepErrorFile As Integer = CInt(Dts.Variables("vDaysToKeepErrorFiles").Value.ToString)
OnError,servername,networklogin,PkgName,Rename Error Files,{8d38e1b7-44e8-419e-963e-c689edd0be2c},{EA6E6337-8C07-428D-9E3B-CEEB4F95A185},3/10/2006 5:24:30 PM,3/10/2006 5:24:30 PM,7,0x,Error 30456: 'Log' is not a member of 'Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel'.
Line 49 Columns 25-31
Line Text: Dts.Log(MaintenanceMsg, 0, ZeroByte)
OnError,servername,networklogin,PkgName,Rename Error Files,{8d38e1b7-44e8-419e-963e-c689edd0be2c},{EA6E6337-8C07-428D-9E3B-CEEB4F95A185},3/10/2006 5:24:30 PM,3/10/2006 5:24:30 PM,7,0x,Error 30456: 'Log' is not a member of 'Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel'.
Line 55 Columns 17-23
Line Text: Dts.Log("Script Error:" + ex.Message, 0, ZeroByte)
OnError,servername,networklogin,PkgName,Rename Error Files,{8d38e1b7-44e8-419e-963e-c689edd0be2c},{EA6E6337-8C07-428D-9E3B-CEEB4F95A185},3/10/2006 5:24:30 PM,3/10/2006 5:24:30 PM,5,0x,The script files failed to load.
PackageEnd,servername,networklogin,PkgName,{A6778813-1F3A-4133-A00C-6F02AC8CC8B1},{EA6E6337-8C07-428D-9E3B-CEEB4F95A185},3/10/2006 5:24:30 PM,3/10/2006 5:24:30 PM,1,0x,End of package execution.
I've been using the same scripts for months in development and testing. Both dev and test server has SQL 2005 and SSIS installed.
What causes this?
is there anyway to retrieve the database properties and display in an asp.net web form as a quick over view rather than logging onto the server to check, items such as size, space available, last backup data etc? Cheers
View 2 Replies View RelatedHi and thanks for your help
specifying the default database means what. for instance when I add alog in user and I have to choose a default database. Does it make a difference if the Default database is Master or any other user database name. What is the significant to select Master vs any other database.
Thanks,
Ahmed
Hello!
We are having problems with a single SQL Server where the Server properties will not save, and always revert to the default.
It occurs only on those tabs with "configured" and "running" options at the bottom. Other tabs will keep the settings we custom.
The big problem is with the memory and processor tabs which even when we've made only a single change and stopped and started the service, reverts back to a default.
Any clues - we are logged in as "sa" and have not removed the SA priviledges.
Thanks for any help,
Simon
Once upon a time, I went to check the properties of an instance and EM just hung - anyone know why this might happen?
View 1 Replies View RelatedHi all,
Plz help me to know whats wrong with following script:
EXEC sp_addextendedproperty
@name = 'col_Programs_ID_Description',
@Value = 'The Unique Identifier for a specific Program',
@level1Type = 'Programs',
@level2Type = 'ID'
I get the following error:
Server: Msg 15600, Level 15, State 1, Procedure sp_addextendedproperty, Line 42
An invalid parameter or option was specified for procedure 'sp_addextendedproperty'.
NOTE: If I dont use the last 2 parameters this procedure runs fine, but it adds the Extended Property to the Database Level while I'm trying to add it to the TABLE-->COLUMN level.
Thanks
Mariah
Hi all,
I'm having a problem need your help:
I can see all properties of datafile (FilegroupName, FileID, FileType,
Location, CurrentSize, Space Used) by Enterpise Manager.
Please tell me how do I see all those properties by SQL Query Analyzer.
I want to know actual space used in data file to shrink file.
Thanks in advanced,
TN
Running SQL2000 SP3.
We installed an application named Streamserve. Now, if I go into Enterprise Manager I can expand the databases fine. But when I try to right-click properties Enterprise Manager goes bye bye. No error messages. I tried this on master and same thing. I currently have 2 different machines - a dev and a QA box and both are behaving badly.
Any ideas?
Thanks
Sharon
Hi,
when ever I try to look at the properties of a job, the create new job window appears. what gives?
When I create a new database it asks for information regarding the Data files.
What is it for? Will this file get creted to the location that I write?
How often will it get copied there?
Help;Im New with a company and the sql server ismaxing out the cpu'sWe have 3 web servers load balanced....large volume of datathe current PropertiesComputer:4 amd 2.88 processors4 g MememoryRecomendations of good sql setupmemory, cpu etcThank youmike
View 6 Replies View RelatedHas anyone tried to open a cube into Business Intelligence Studio and the properties for the database vanished (project menu, properties)?
How do you get them back?
Hello
Im having abit off trouble with my images positioning..
I have 3 images in the header placed side by side with a rectangle around them sent to the back
In layout view the images look correct, however when i deploy the report the rectangle appears on top and then the images appear undernealth each other...when they should be inside the rectangle. is there something like float on top properties similar to objects in Word?
A separate question, I also have a table to the right off the table i have an image and under that image another image...when i preview the report the second image is pushed to the bottom of where the table ends...is there someway to make the image appear side by side to the table instead off getting pushed down to the bottom...something similar to a frame in HTML ?
thanks
Hi.
I am trying to look for ways on how to get all the databse properties under each instance.
say I want to view the size, recovery model, physical location, etc.
The sys.database_files is only applicable per database. Is there a query, or a table in master database to get these or store these values?
thanks...
Hi:
Does anyone know of a good primer on extended properties and why I would want to use them. I have you the on-line books sections but that does a clear "why". I have search for white papers and similar documents.
I understand they are good for documentation, but I was looking for something that explain Microsoft long-term vision. How I might use them in template scripts, VSTS, etc.
Thanks in advance for your help.
Gene
Hi all, Is it possible when creating a stored procedure through visual studio using a sql server 2005 project, to set the sizes of the parameters that are specified. For example:
public partial class test{ [Microsoft.SqlServer.Server.SqlProcedure] public static void addRecord(string name, string details) { ................. some code ................. }}
Would it be possible to set the size of the parameter 'details' to nvarchar(max) and 'name' to nvarchar(50) or something along those lines. The problem at the moment is that when this project is deployed both of the parameters are set to 4000 characters and sometimes the details parameter are greater than 4000 characters and it is being truncated.
I am currently running some sql that alters the procedure to set the sizes of the parameters but this isn't really an ideal solution.
Any help would be gratefully appreciated.
N
I am trying to find information on Database properties - more specifically, what the 'Space Available' means, because right now when I look at the properties of a database I am setting up, which will grow substantially I am sure, it says the database size is 154 MB and the Space Available is 42 MB. What is the Space Available? What does this refer to and is it going to be restricting the growth of the database? Thanks.
View 7 Replies View RelatedHi,
I have a chart that is created in SSRS with the size property set to '15cm, 8.5cm', I want to set the height based on a parameter that is passed to the chart ( so that it fits onto a 1 page report it is fed through to), I have tried putting =Code.SetChartHeight() in the height property but it brings up an error saying it needs to be in a format like '8.5cm'. The SetChartHeight() function just returns the height parameter + 5.
Does anyone know how I can do this?
Many thanks in advance