Changing The Value Of A Variable With The Script Task
Mar 26, 2008
I want to set the value for a user defined variable with the script task with the intention of using that value as a condition in both of two Precedence Constraints for the purpose of determine which of two different direction the package will go. The problem is I don't know how to reference the User Defined variable in the Script of a Script task, nor how to alter its value.
Can anyone help?
View 5 Replies
ADVERTISEMENT
Oct 25, 2006
I'm working on an SSIS package that uses a vb.net script to grab some XML from a webservice (I'd explain why I'm not using a web service task here, but I'd just get angry), and I wish to then assign the XML string to a package variable which then gets sent along to a DataFlow Task that contains an XML Source that points at said variable. when I copy the XML string into the variable value in the script, if do a quickwatch on the variable (as in Dts.Variable("MyXML").value) it looks as though the new value has been copied to the variable, but when I step out of that task and look at the package explorer the variable is its original value.
I think the problem is that the dataflow XML source has a lock on the variable and so the script task isn't affecting it. Does anyone have any experience with this kind of problem, or know a workaround?
View 1 Replies
View Related
Mar 6, 2008
I have a SQL Task that updates running totals on a record inserted using a Data Flow Task. The package runs without error, but the actual row does not calculate the running totals. I suspect that the inserted record is not committed until the package completes and the SQL Task is seeing the previous record as the current. Here is the code in the SQL Task:
DECLARE @DV INT;
SET @DV = (SELECT MAX(DateValue) FROM tblTG);
DECLARE @PV INT;
SET @PV = @DV - 1;
I've not been successful in passing a SSIS global variable to a declared parameter, but is it possible to do this:
DECLARE @DV INT;
SET @DV = ?;
DECLARE @PV INT;
SET @PV = @DV - 1;
I have almost 50 references to these parameters in the query so a substitution would be helpful.
Dan
View 4 Replies
View Related
Jan 28, 2008
When creating a variable you assign a value to it. Example: D: estA
How do you change the value of a variable once assigned. Example: D: estB
Also is there any way to delete user variables that you do now want. I created variables during development and now I have no need for them.
Thanks
View 3 Replies
View Related
Oct 19, 2007
Hi,
I am relatively new to SSIS.
Please advice me on how to change the value of a variable during runtime.
i.e. user should be able to key in the value.
Regards,
Jiju
View 3 Replies
View Related
Jan 15, 2007
I have an Execute SQL Task that selects one column value from one row, so General > ResultSet = Single row. Result Set > Result Name = 0 (the first selected value) and Variable Name = User::objectTypeNbr. The task runs successfully, but after the it runs the value of User::objectTypeNbr is not changed.
User::objectTypeNbr > Data Type = Int32. When I declared the variable Value could not be empty so I set it to 0 arbitraily, assuming it would be overwritten when assigned a new value by the Execute SQL Task, but it remains 0 after the task runs. What am I missing here?
View 11 Replies
View Related
Mar 16, 2007
Changed stored procedure
[dbo].[spLogonName @pNewLogonName varchar(60) AS
SELECT * FROM .dbo.tblUser Where vcLogonName = @pNewLogonName
to
[dbo].[spLogonName @pNewLogonName varchar(60) AS
DECLARE @Local_pNewLogonName varchar(60)
SET @Local_pNewLogonName = @pNewLogonName
SELECT * FROM .dbo.tblUser Where vcLogonName = @Local_pNewLogonName
and started getting this error on the web page.
ADODB.Recordset error '800a0cb3'
Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
Does anyone know why this is happening? Nothing on the site has changed. If I change the sp back the errors go away. I'm trying to use local variables in all SP to avoid the slowness that can happen when using the parameter varibles.
View 2 Replies
View Related
Apr 12, 2007
Hiya guys,
The question:
Can I design data flows with an XML Source pointing to file system xml files, and but run them against variables? I can see the properties at design time (Accessmode=0,1,2; XMLDataVar="User::XMLData), but the XMLSource object doesn't appear to have expressions enabled to change this at runtime, nor do these properties seem to be exposed to configurations.
The scenario:
I have a package that reads through (potentially thousands) of XML files, and having identified the embedded message "type", transforms them via XSLT to an easier XML format (XML Datasource can't cope well with multiple namespaces etc). Then send this the new file off to a type specific dataflow task to send contents to database.
For performance (and other) reasons I'd rather XSLT to a single shared variable and use this variable as the XML source in the data flows (Rather than writing out to the filesystem [via xslt] and immediately reading it back in each time [via datasource]).
But designing the data flow task using a variable as xml source is frustrating for a bunch of reasons - not the least being:
(a) The variable needs to be populated with sample xml data at design time. But this could only ever match one dataflow at a time (fine at run time, but painful at designtime - leading to validation errors popping up all around the place.)
Yes I could have a seperate variable for each xmlsource - but that just makes things more complicated up front and also leaves me with 20+ large, type specific, xml variables floating around at runtime of which only one is ever being used per import - which just doesn't feel right to me.
(b) populating the variable with sample xml at design time is painful due to it being a string - and not accepting hard returns etc that are in text files, design time changes etc)
Using a file XML source at design time is infinitely easier, when I get a design time change - I can just amend the XSLT and run the appropriate task to produce a sample XML file to design against.
Any ideas?
Ta.
Gus.
View 2 Replies
View Related
Sep 28, 2006
I've got two Sql Tasks on my dtsx. The first one loads a value into "Proyecto" user variable and the second one executes a variable named "SegundoProceso" which contains from the beginning:
"select Fecha from LogsCargaExcel where Proyecto = " + @[User::Proyecto] +""
As SqlSourceType propety I have "Variable" and inside ResultSet or Parameter Mapping nodes there is nothing.
[Execute SQL Task] Error: Executing the query ""select Fecha from LogsCargaExcel where Proyecto = " + @[User::Proyecto] +""" failed with the following error: "Cannot use empty object or column names. Use a single space if necessary.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Where am I wrong?
TIA
View 12 Replies
View Related
Jan 3, 2007
Hi,
I have an Execute SQL Task (OLE DB Connnection Manager) with a SQL script in it. In this script I use several SQL variables (@my_variable). I would like to assign an IS variable ([User::My_Variable]) to one of my SQL variables on this script. Example:
DECLARE @my_variable int
, <several_others>
SET @my_variable = ?
<do_some_stuff>
Of course, I also set up the parameter mapping.
However, it seems this is not possible. Assigning a variable using a ? only seems to work in simple T-SQL statements.
I have several reasons for wanting to do this:
- the script uses several variables, several times. Not all SQL variables are assigned via IS variables.
- For reading and mainenance purposes, I prefer to pass the variable only once. Otherwise every time the script changes u need to keep track of all questionmarks and their order.
- Passing the variable once also makes it easier to design the script outside IS using Management Studio.
- This script only does preparation for the actual ETL, so I prefer to keep it in one task instead of taking it apart to several consecutive Execute SQL Tasks.
- I prefer to use the OLE DB connection manager because it's a de facto standard here.
Could anyone help me out with the following questions:
- Is the above possible?
- If so, how?
- If not, why not?
- If not, what would be the best way around this problem?
Thanx in advance,
Pipo
View 6 Replies
View Related
May 18, 2006
Greetings once again SQL friends,
Sorry to bug you with my silly questions but this little problem has been driving me crazy for the last hour or so!
I am attempting to change the data type of a variable in an expression but I keep getting an error saying that the expression can not be evaluated.
The syntax I am using is as follows :
(dt_str) @[User::MAX_OFFER_PRICE_ID]
My variable MAX_OFFER_PRICE_ID is type int32 and I am attempting to cast it as a string.
What am I doing wrong?!
Thanks for your help in advance.
View 7 Replies
View Related
May 11, 2007
I'm new to SSIS so please be gentle...
I'm creating a package that needs to go to an FTP site (FTP Task), download a file, unzip it and then process a series of table loads for the 12 text files that will be unzipped. My problem is that the zip file is a date (yyyymmdd.zip) which is normally the previous day of execution EXCEPT on Mondays when it would be the previous Friday's date. My thought is that IF (magic question) I could determine the day of the week in the SSIS package, I know that Tuesday-Friday is just a formatting exercise of getdate()-1 and Monday would be getdate()-3 but I can't seem to find a way (function?) that will allow me to determine the day of the week?
Thanks in advance!
View 6 Replies
View Related
Jun 15, 2006
Is there any way to change variable scope while using package templates?
I have created a package template that has several variables, a "typical" control flow and data flow. My goal was to try and use this as a starting point to create other packages within the same project and edit as required in the new package. I couldn't find any way (yet) to change scope of variables...these still show as belonging to the scope of package used to create the template.
Appreciate any help...thanks.
View 4 Replies
View Related
Apr 18, 2006
Hello
I use SSIS to load a Unicode file into a single table
I Use a "slowly changing dimension" task to load the destination table and when i map a column (DT_WSTR) to a column with the datatype nvarchar(max) i have an error message that say that i can't map theses columns because there have not the same datatype.
I find a workaround : i map all my cols except the colums that must fill the cols with datatype nvarchar(max) , and after i modify manually the 2 subtask generated by the "slowly changing dimension" task (the insert and the update) and with this way i don't have error messages
It works fine but is it the good way?
It seems to be a bug from ssis?
Thanks in advance.
Nicolas Lievain
View 1 Replies
View Related
Apr 5, 2006
We have successfully built a SSIS ETL implementation for a data mart. Most of our dimension loads are using the slowly changing dimensions task. We successfully built every package and had 1 complete successful load.
We have made a modification to one of the tables that now has 16 mil records in it. I open the dimension's package and it takes 30 sec - 1 minute to validate. When I go to the Data Flow tab and attempt to open the Slowly Changing Dimension task, SSIS will freeze up. I will get no response for hours. I my testing so far SSIS has yet to come back.
My CPU usage is below 5%. devenv.exe memory usage is at 113 Mb. My computer is using 400mb / 1Gb of memory. The status bar at the bottom says "ready". I have let it sit for up to 2 hours with no results. When I kill the process in the Windows Task Manager it ends instantly.
I have also tried deleting the task and adding a new Slowly Changing Dimension Task. When I select the table from the drop down I get the same results. I have noticed this with all my million + record tables that use the slowly changing dimension task but not the smaller tables.
I am also seeing the problem when I am in "Work Ofline" mode.
I am accessing a SQL 2005 server over a VPN connection. I am connecting to the server using a Native OLE DB OLE DB for SQL Server connection. My computer is running Windows 2000 SP4, Intel Pentium M1.86 Ghz, 1 Gb of RAM.
Can a Slowly Changing Dimension Task be used on large tables? I can understand the process taking a while to run but I do not understand why I can not edit the task.
View 3 Replies
View Related
Aug 15, 2005
Okay, this one might stump you guys.
View 3 Replies
View Related
Feb 16, 2008
Hello,
I have setup a package configuration and it ran fine; however, I would like to be able to use the script task to change content of the dtsConfig file. For example, I can get the newServerName using the SQL Task, then how can I assign the newServerName value to the DataSource in the package configuration file? Is this possible?
Thanks,
Andrew
View 17 Replies
View Related
Oct 27, 2006
Does anyone know how to change the task name displayed within a ForEach Loop Container (or of the ForEach Loop Container task itself) based on a variable. I am pretty familiar with setting variable values during task execution and using expressions to alter task properties based on variables. I have tried using an expression to alter the value of the Name property of the ForEach Loop Container but the name of the ForEach Loop Container does not change during execution. Since the color of the various tasks change during execution, I would think that the task names could be changed as well.
View 7 Replies
View Related
May 2, 2008
We find that if we deploy the OLAP database with a different name on the test server, then regardless of how we change the connection string provided to the SSIS package that processes the cube, then the package fails to connect to the database. To clarify:
In development the OLAP database is called MyOlapDB and the source database is called MySqlDB. Both are on the same machine. When the the application is built and released for test, the test team install the databases on a replica of the production environment (i.e. web app on one machine, OLAP DB on another and SQL database on yet another). They also, quite rightly, implement the new test databases so they incorporate the build version number. So, MyOlapDB123 and MySqlDB123 are both from build 123.
This is when the problems start. Regardless of how the connection string is specified in the job that processes the cube, the SSIS integration package fails with the error:
[Analysis Services Execute DDL Task] Error: Errors in the metadata manager. Either the database with the ID of 'MyOlapDB' does not exist in the server with the ID of 'OurTestServer', or the user does not have permissions to access the object.
We have tried config files and job properties, but neither work. Also, simply attempting to run the package using the DTEXECUI does not work either.
Looking inside the XML of the package, we clearly see the ConnectionManager object which has the original connection string, which is
Data Source=localhost;Initial Catalog=MyOlapDB;Provider=MSOLAP.3;Integrated Security=SSPI;Impersonation Level=Impersonate;
However, editing the initial catalog here still does not solve the problem. Searching the XML for the string MyOlapDB reveals the OLAP database name in two other places - both within the object data of the two Analysis Services Execute DDL tasks.
Anyone know how to solve this problem without having to hack the XML of the package?
View 4 Replies
View Related
Mar 24, 2003
How to set and reference Global Variable in a SQL Task (MS SQL 2000)
:)
View 1 Replies
View Related
Nov 30, 2006
Greetings once again,
I am trying to achieve a seemingly simple task of assigning datetime value to a user variable at the point my package starts running. How can I do this without using a SQL Script Task? Should I be using a script task for this or is there a simpler way to achieving the same thing?
Thanks in advance.
View 5 Replies
View Related
Feb 20, 2007
Hello,
What I'm trying to do is get an XML query from a database and use the XML to render an excel document. Can this be done using SSIS? Can I actually read a column from a database and store it in a variable and then create an excel spreadsheet with that variable in SSIS? Would this be done in the control flow using the XML task editor?
Thanks,
Phil
View 5 Replies
View Related
Feb 21, 2008
i need to know how many rows are in a certain table and store this value in a variable in order to process this variable later in the package. of course i can build a data flow task within a row count component but as far as i understand it's necessary to read all data from a data source in order to use the row count component. now the question is if it's possible to use a sql task in the control flow and put a select count(*) statement within the task and then write the result of this select statement into a variable. shouldn't that be much more faster than using a whole dataflow for this problem?
View 1 Replies
View Related
Jun 14, 2006
Hi all,
I would like to ask how I can use the variable as the input parameter of web services task.
In microsoft 's document, http://msdn2.microsoft.com/en-us/library/ms187617.aspx, It suggests the for the value, If the Variable check-boxes are selected, select the variables in the list to provide the inputs; otherwise, type the values to use in the inputs. but I cannot find such Variable check-boxes.
It just want to know how I can check the Variable check-boxes.
Many Thanks
Spencer
View 4 Replies
View Related
May 25, 2001
Hi,
I am tring to figure out how to retrieve the value of a global variable from s SQL task, the value for the Global variable is set in a Active Script Task. Any help is greatly appreciated.
Thanks,
Satish.
View 1 Replies
View Related
Nov 27, 2006
Hi there
I have a bit confusing problem,
In Execute SQL Task I am having a stmt like : (Select * from Emp where EmpNm=?) also I m passing variable value through Parameter Mapping.
Problem I am facing is that if I remove brakets from both end task is executed successfull but if I but those braket as they are task execution fails. and i need those brakets as it is inside a if statement.
Problem is with parameter passing ,even if i put some value as EmpNm="ABC " with brakets, it runs successfully
Any Solution to above problem
Thanks and Regards
Rahul Kumar, Software Engineer
View 3 Replies
View Related
Jul 17, 2006
This doesn't seem possible but I'll ask anyway...
Can I build a lookup task where the lookup query is based on a variable, rather than hardcoding the SQL staement?
View 3 Replies
View Related
Feb 14, 2007
I have a variable SYear with the data type Integer and the value 2005.
Connection type is OLE DB, and my sql statement is:
DECLARE @MyYear Int
SET @MyYear = ?
I have set the variable User::Syear as Input with the parameter name=0, there is no result set. I set BypassPrepare both True and False. However, this simple statement does not work. I keep having an error. If I put integer value directly into @MyYear, it is fine. What is wrong in here? Somebody help me!
View 17 Replies
View Related
May 6, 2008
Hi,
How can I delete records from one table using date variable condition?
or should I use string?
here is the sql : DELETE FROM TABLE WHERE DATE = @VARIABLE
View 1 Replies
View Related
Nov 6, 2007
Hi
I need to create a Table using the SQL Task and a Variable as the Table Name
I am getting an Error: "Syntax error or access violation". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
The SQL Statement that I am using is
Create Table ? (ColumnA char(5) Null)
The ? is the Value of the Variables
Is there a way of doing this
RegardsQ
View 4 Replies
View Related
Sep 5, 2006
I created a ftp task that uses a variable for the remote path because the file I download changes names every based on the date. So I build up the entire path into a container variable and set the remote path to a variable. then I get an error that the filename does not begin with '/' when the filename that the error references is my variable... I cannot even debug/build my package cause of this error. I cannot find anything online or in BOL. any help would be appriciated. If you need more info to help let me know also.
My variable is set as a string,
exact error:
Error 1 Validation error. Get DailyFiles FTP Task: Variable "DailyFiles" doesn't start with "/". DAILY.dtsx 0 0
Thanks in advance.
View 3 Replies
View Related
Aug 22, 2006
Hi!
I need help with some C# code. I have build a SSIS package with an Execute Process Task. I need to send dynamic variables in to my C# program so I thought it was a good idea to use the StandardInputVariable.
How do I get the variable in my C# code?
Thanks
Carl
View 19 Replies
View Related
Jan 31, 2008
I have looked thru several similar threads with errors like this, but have not found a resolution. I have a SQL Task that runs this query:
Code Snippet
select NetRevenue = cast(sum(Base_Price + AL + MI + PO) as dec(10,2))
from Lancelot.DataWhse.dbo.GrossMarginDetail
where tran_date_key <= ? + ' 23:59:59' and
label_group <> 'X' and
not (ar_ship_key in ('S999991','S998101''S998102')) and
Document <> 'Cust Bal Debit Memo'
There is a parameter mapping of "User::LastSaturday" of type date. I also have a result set with a result set name of "0" with a variable name of "User::GrossMargin," which is defined as a double in the package. The task has a resultset type of Single row, and at the moment the answer that is returned is 66228637.10.
If I change the package variable to a type of string it of course works, but then I cannot do comparisons against it. I have step by step manually copied this from an existing DTSX, so I am baffled why this isn't working, and I'm ready to throw myself under a truck!
I also tried to bring it in as a string, then convert it in a script task, but I cannot figure out how to reference the input and output variables. I can't seem to find any relevant docs on how to do that...
If anyone has any ideas, I and my sanity would greatly appreciate it.
View 5 Replies
View Related