How To Add The Value Of A Variable To Column In A DataSet

Sep 8, 2006

Hi,

i'm working on a Data Flow which uses a "Flat Sile Source" to read a CSV-file and then sends the transformed data to a "OLE DB Destination".

What i need is a way to add a column to my transformed data which contains a value from a User-Variable.

My User-Variable contains the key for the data, and this one value shall replicate to all Rows in the DataSet.

So anybody know of an existing Data Flow component, which can do this?

Regards, Martin

View 3 Replies


ADVERTISEMENT

Connect To A DataSet Variable As A Source?

Apr 16, 2007

Hello. I€™m new to SSIS. This forum and Kirk Haselden€™s book are my teachers. I€™m having a hard time grasping something basic to get started defining a set of packages to automate the ETL process, however, and perhaps I€™m simply misunderstanding the best practices of SSIS.

I have source data in two different transactional databases, and use OleDb connection managers (and OleDb Source components in the Data Flow) to extract the data. I use a Script Task and several Lookup widgets in the Data Flow to transform the data, and output each to two different package-scope DataSet variables.

How do I join these two datasets in a third Data Flow task for loading into my data warehouse? It seems I can iterate through them in the Control Flow, but I can€™t write a query against them in the Data Flow, since there is no connection manager that allows me to €œconnect€? to a package-level variable. Should I instead be storing my extracted, transformed data in temporary database tables, and then joining these to do the final load?

Any advice greatly appreciated. Thanks in advance.

View 1 Replies View Related

How Can I Have A Variable Number Of Parameter Values In A Dataset?

Apr 20, 2007

I have a strongly typed dataset, and I need to be able to do a search on multiple values of a parameter.  The problem is I don't know how many.  I have a textbox that the user can enter search words in.  The select string is built from the string of words that are entered, like this:For iCount = 0 To UBound(sArray)    strSQL = strSQL & "Description LIKE '%" & sArray(iCount) & "%' OR "Next Can I do this is a dataset method?  How?  If I can't, what are my options?Diane 

View 6 Replies View Related

What Is The Scope Of A Table Variable Defined In A Dataset?

Dec 14, 2007

if a dataset doesnt use a stored proc to define a table variable, what is the scope of that table variable? Does the name need to be unique from such variables defined by other datasets?

View 4 Replies View Related

Table Column Names = Dataset Column Values?!

Apr 28, 2008



I need to create the following table in reporting services



PRODUCT April March Feb

2008 2007 2008 2007 2008 2007
chair 8 9 7 4 4 4
table 3 4 5 6 4 6





My problem is the month names are a column in the dataset, but I dont know how to get it to fill as column headers???


Thanks in advance!!!

View 1 Replies View Related

Dataset Into A Table Or Matrix With Fixed Number Of Columns, Variable Rows

Jul 13, 2007

Hi

I have a dataset with 2 columns, a rownumber and a servername - eg



rownumber servername

1 server1

2 server2

....

15 server15



I want to display the servernames in a report so that you get 3 columns - eg



server1 | server2 | server3

server4 | server5 | server6

...

server13 | server14 | server15



I have tried using multiple tables and lists and filtering the data on each one but this then makes formating very hard - i either end up with a huge gap between columns or the columns overlap



I have also tried using a matrix control but cant find a way to do this.



Does anybody know an easy way to do this? The data comes from sql 2005 so i can use a pivot clause on the dataset if somebody knows a way to do it this way. The reporting service is also RS2005



Thanks



Anthony

View 1 Replies View Related

How To Add A New Column To A Dataset

Aug 21, 2007

I have had to add a new column to a mobile 5 database in VS2005. I obviously have added it in the wrong way. I have two applications that use the same db. The .net application accesses the table with the new column fine., this is where I added it first. When I try to add the column to the Compact framework (Pocket Pc) app I get this error when I try to run the application. In both applications the Server explorer shows the new column.
The column name is not valid. [ Node name (if any) = ,Column name = GUID ]
As long as I remove the GUID column from the tableadapter.fill sql the program runs the same as before.( even though the sql executes in the query designer with the GUID column in the sql statement.)
How do I add the column so that the Dataset.designer.cs gets updated and can load the new column?

Thanks I hope this make sense.
Jon Stroh

View 1 Replies View Related

Return Dataset In One Column

Nov 7, 2006

Hi thereI have the following two tablesmainprofile (profile varchar(20), description)accprofile (profile varchar(20), acct_type int)Sample data could bemainprofile----------------prof1 | profile oneprof2 | profile twoprof3 | profile threeaccprofile--------------prof1 | 0prof1 | 1prof1 | 2prof2 | 0Now doing a join between these two tables would return multiple rows,but I would like to know whether it would be possible to returnacct_type horizontally in a column of the result set, e.g.prof1 | profile one | [0,1,2]prof2 | profile two | [0]I could probably manage this with cursors, but it would be veryresource intensive. Is there a better way?Regards,Louis

View 2 Replies View Related

Updating Column In A Dataset Not Working

Aug 8, 2006

Hi all,
I'm trying to update various rows in my DB with a new value once an action occurs.  I am using the following code which does not throw any exceptions, but also does not change the values.  Can someone steer me in the right direction?
public static void ChangeRefCode()
{
SqlConnection dbConn = new SqlConnection(ConnectDB.getConnectString());
SqlDataAdapter dataAdapt = new SqlDataAdapter("Select * from Posting",dbConn);

DataSet ds = new DataSet();

SqlCommandBuilder sqBuilder = new SqlCommandBuilder(dataAdapt);
dataAdapt.Fill(ds, "Posting");
foreach (DataRow dr in ds.Tables["Posting"].Rows)
{
dr["ref_code"] = DateTime.Today.Ticks + "-" + dr["poster"].ToString();
}
try
{
dataAdapt.Update(ds, "Posting");
}
catch (Exception ex)
{
ex.ToString();
}
finally
{
dbConn.Close();
}
}

View 3 Replies View Related

Missing Column In Returned Dataset.

Nov 21, 2006

I have a web page that has been in production for over a year.  On occasion the web app users report sporadic errors which last a few minutes then go away.  The page loads up a generic DataSet, and then that DataSet is assigned to a datagrid on the page.  The error is that a column that is expected to be in the dataset is not found.  I know this column must exist in the database because its a required field.  After we reset IIS, then all returns to normal and the errors go away.  Below is the stack trace.
 Exception: System.IndexOutOfRangeException  Message: Cannot find column LastName.  Source: System.Data     at System.Data.DataTable.ParseSortString(String sortString)     at System.Data.DataView.UpdateIndex(Boolean force)     at System.Data.DataView.SetIndex(String newSort, DataViewRowState newRowStates, DataFilter newRowFilter)     at System.Data.DataView..ctor(DataTable table, String RowFilter, String Sort, DataViewRowState RowState)     at MySystem.Web.GuestSearch.ShowResults(DataSet ds, Int32 currentPageIndex)     at MySystem.Web.GuestSearch.LoadResults(Int32 currentPageIndex)     at MySystem.GuestSearch.btnSearch_Click(Object sender, EventArgs e)     at System.Web.UI.WebControls.Button.OnClick(EventArgs e)     at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)     at System.Web.UI.Page.ProcessRequestMain()
Our DBA can find no problems on the database side and our web servers don't log any system event problems either.  I do not understand why resetting IIS helps the issue.  I need to find the real cause of the problems rather than just resetting IIS all the time.  Any ideas?
 

View 1 Replies View Related

Extract The Value Of A Datetime Datatype From A DataSet Column

Nov 4, 2006

Hello,
I'm having trouble extracting the datetime value of a datacolumn in order to compare it's value to another datetime. The error I get is "unable to cast object of type System.Data.DataColumn to type System.DateTime. I'm sure I'm just missing a step or a cast, but nothing has worked. I hope someone can help!
Here's the code:
protected void ddlRooms_SelectedIndexChanged(object sender, EventArgs e)
{
SqlCommand cmd;
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["EventBookingConnectionString"].ConnectionString);
SqlDataAdapter da;
DataSet ds;
try
{
cmd = conn.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT Events.ID as 'Event ID', Name as 'Event Name', Rooms.Room as 'Event Room', AttendeeList as 'Attendee List', EventDate as 'Event Date' from Events INNER JOIN Rooms on Events.Room=Rooms.ID";
ds = new DataSet();
da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(ds, "BookedRooms");
if (ds.Tables["BookedRooms"].Columns["Event Room"] != null)
{
foreach (DataRow row in ds.Tables[0].Rows)
{
string room = (string)row["Event Room"];
if (ddlRooms.SelectedItem.ToString() == room)
{
System.DateTime date = (System.DateTime)ds.Tables[0].Columns["Event Date"];   //HERE'S WHERE THE ERROR OCCURS
if (Calendar1.SelectedDate == date)
{
lblBookedRooms.Visible = true;
lblBookedRooms.Text = "I'm sorry, that room is booked for that day.<br />Please choose another day or a different room.";
}
}
}
}
}
catch (Exception ex)
{
lblResults.Text = ex.Message;
}
}
Thanks in advance to anyone willing to help out!
Monster

View 8 Replies View Related

Dataset Query With Alias Column And Allow Searches

Jul 13, 2005

I have a form that loads a dataset.  This dataset is composed from SQL statements using alias and unions.  Basically it takes uses data from 3 tables.  This dataset also has a alias column called ClientName that consists of either people's name or business name.In addition, the form also consist of a search field that allows user to enter the 'ClientName' to be searched (i.e. to search the alias column).  So, my question is how can the alias column be searched (user can also enter % in the search field)Function QueryByService(ByVal searchClientNameText As String) As System.Data.DataSet
If InStr(Trim(searchClientNameText), "%")>0 Then            searchStatement = "WHERE ClientName LIKE '" & searchClientNameText & "'"Else             searchStatement = "WHERE ClientName = @searchClientNameText"End If
Dim queryString As String = "SELECT RTrim([People].[Given_Name])"& _"+ '  ' + RTrim([People].[Family_Name]) AS ClientName, [Event].[NumEvents],"& _"[Event].[Event_Ref]"& _"FROM [Event] INNER JOIN [People] ON [Event].[APP_Person_ID] = [People].[APP_Person_ID]"& _searchStatement + " "& _"UNION SELECT [Bus].[Organisation_Name],"& _"[Event].[NumEvents], [Event].[Event_Ref]"& _"FROM [Bus] INNER JOIN [Event] ON [Bus].[APP_Organisation_ID] = [Event].[APP_Organisation_ID] "& _searchStatement
..........End Function

View 2 Replies View Related

Adjusting Column Width In Queried Dataset

Apr 17, 2007



I am trying to eliminate the extra space in columns that have been returned from a DB query...the tables have character lengths of 40, I would like to return just the necessary characters.



Thanks in advance.



Mark.

View 3 Replies View Related

How To Update A Column In Input Dataset With 'NA' If It's Null

Feb 6, 2007

Do I have to use condition split?, then union all?

if in script, I can use update from <tablename> Set column = isnull(column, 'NA'). It's so simple.

I'm also wondering can we run SQL Script against input dataset in a SSIS component?

 

 

View 6 Replies View Related

How To Update A Column In Input Dataset By SQL Query?

Feb 5, 2007

I'm bothered by an issue of updating a column in input dataset from a update query. It looks like SSIS has a very poor function on this.

Example, I have an input dataset of name, salary, dept_no, and I have another table called departments which has fields of dept_no, Dept_name, basic_salary

now I want to update salary column in input dataset with basic_salary if it's salary is smaller than the basic_salary.

update #tmp set salary = basic_salary where #tmp.salary <departments.basic_salary and #tmp.dept_no = departments.dept_no

 

how could I impletement this in SSIS package?

I tried with lookup, modify scripts by enabling memory restriction. It doesn't say any error when I save the package, but I never get pass debug.

HELP!!

 

 

View 5 Replies View Related

Adding Dataset Column Values To My Table At The End

Mar 14, 2006

Hi,

I am mapping an entity from SQL 2005 to another entity in another system on SQL 2000. Since the destination system has its own ID generator, I want to keep the generated ID for each row of my table in a column of my table in SQL 2005. The new column is in the dataset now , but I don't know how to update my table to have that column values (The OleDbDestination just insert new items.)

Samy

View 1 Replies View Related

Transact SQL :: Calculate Third Column Using Second Column And Variable

Nov 23, 2015

create table #t
(
id int,
col1 decimal(18,2)
)
go

[Code] ...

-- I want to subtract @X and col1. But my variable @X must be reduced for each value in col1 for each next row until it reaches zero.

-- OUTPUT:

-- id col1 col2
--@X at starting point is 15000
-- 1 5000.00 0 --@X IS 10000 = 15000 - 5000(col1)
-- 2 1000.00 0 --@X IS 9000 = 10000 - 1000
-- 3 10000.00 1000.00 --@X IS 1000 = 9000 - 10000
-- 4 12000.00 12000.00
-- 5 300.00 300.00
-- 6 35000.00 35000.00

--in col2 i just put zero where col1 is substract from @X and continue for every subsequent order.
-- in 3 row value is 1000 becouse @X is that big (1000 left from col1)

View 13 Replies View Related

Adding 2 Columns In A Dataset As A Single Column In Datagrid

Nov 9, 2006

hi,
i am having 2 columns in a table in a dataset.
i want to add those two columns and bind the resultant total as a single column to the datagrid.
is it possible.
if yes, how o acheive this?
please help me.
thanks in advance.
muppidi.

View 1 Replies View Related

Display Column Names And Its Values Programatically From The Dataset

Apr 18, 2008

Hi.

In my report, I need to display column names (and its values) from my dataset, which uses the stored procedure and within it use the PIVOT statement. I cannot use the matrix control in report since I need to add another static column to the right of the matrix, but since that cannot be done ni SQL SSRS 2005, I need to PIVOT it through stored procedure. The parameter passed to stored procedure is the year and it is used for pivot. The statement looks like this:

@sql = 'SELECT * FROM (SELECT YearId, SchoolId, ReportText, OutputValue_Text from AggregateTable) AS AGAM
PIVOT (MIN(OutputValue_Text) FOR YearId IN ([' + @YearId + '])) PVT'

EXEC(@sql)

So, since the years passed as parameters can change, I cannot hard-code it as column in my report, so I need to programatically display column names and values from my dataset, something like dataSet.Tables[0].Columns[].ColumnName; I have tried with writing the code, but I do not have much experience with it and I have not been very successful. Can someone help me with the code?

Thanks

View 2 Replies View Related

Pass Dataset To TaskScript From Variable, And Be Cleared After The Taskscript.

Jan 19, 2008














Hi, firends,please look at this:

Prepare:

1.prepare a SQLTask component, and read a table by it, return the result in an Variable Object(RegionDim).
2.Pass the Variable into a Taskscript component. In the Script, write this:

Public dtRegion As New DataTable
Public daRegion As New OleDb.OleDbDataAdapter

daRegion.Fill(dtRegion, Dts.Variables("RegionDim").Value)


3.Use dtRegion in the script. It's OK.

Problem:
After the TaskScript, the RegionDim is be cleared in fact. So I can't use it in other places, and need to read the table again.

I think the "daRegion.Fill(dtRegion, Dts.Variables("RegionDim").Value)" mark the RegionDim as the dtRegion, and the dtRegion is a variable scoped inside the Script, which will be distroyed after the Script. So the RegionDim is cleared.

How to avoid this?

Thanks.
Ivan

View 5 Replies View Related

T-SQL (SS2K8) :: Add A New Column To Dataset At Runtime That Tallies Whenever Condition Arises

Nov 3, 2014

I am trying to find a way to provide three metrics for a table that only provides 2 of them. I need to derive a third column which tallies based on conditions that can be found in the dataset.

The table I'm querying shows

(1) total referrals
(2) total moves

but it is missing a column that tallies whenever the referral moved into the same property_id that it was referred to.

create table dimFacts
(date_value datetime
, month_name varchar(9)
, year_number varchar(4)
, month_number tinyint

[Code] ....

How can I use sql to create one additional column for the above data set, ie. let's call it 'property_conversion' such that on the fifth row there will be a '1' showing that on 2012-12-30 lead_id 10038655 moved into the property it was referred to back on 2012-10-15 ?

View 4 Replies View Related

Adding Lookup Programmatically:How Can I Add Column From Reference Dataset To The Transformation?

Jun 19, 2007


Hello,
I have created SSIS package programmatically, I want to add Lookup transformation,
How can I add column from reference dataset to the transformation?
I have try to add new output column but it gives me an validation error, I write following coed to add new output column to lookup.
IDTSOutputColumn90 outputColumn = this.lookup.OutputCollection[0].OutputColumnCollection.New();
outputColumn.Name = col.Name;
outputColumn.Description = "Staging table output";
outputColumn.TruncationRowDisposition = DTSRowDisposition.RD_FailComponent;
outputColumn.ErrorOrTruncationOperation = "Copy Column";
outputColumn.SetDataTypeProperties(col.DataType, col.Length, col.Precision, col.Scale, col.CodePage);

Please suggest other way to add column from reference dataset to transformation output.

View 10 Replies View Related

Integration Services :: Creating A Column With Total Number Of Records In Dataset For Each Row?

Aug 17, 2015

I have a transformation where final result set give me 25 rows of data. Now before I put into destination table, I need to add another column which will show how many total records we have. Like.

My dataset:

A  20 abc
B 24 mnp
c 44 apq

Now I need to add another column within my transformation before I store the result set to destination like this:

A 20 abc 3
b 24 mnp 3
c 44 apq 3

Here. new column gives count of total rows in our dataset which was 3.

How can I achieve this? Can I use derive column to this?

View 6 Replies View Related

How To Show Distinct Rows Of The Column Of The Dataset And Number Of Distinct Rows Of That Column

Mar 29, 2007

suppose i have aDataset with 11 rows. field1 with 5 rows of aaa, 6 rows of "bbb"

I want's some thing like

field1 rowcount
aaa 5
bbb 6

View 1 Replies View Related

SQL Server 2008 :: Populate One Dataset In SSRS Based On Results From Another Dataset Within Same Project?

May 26, 2015

I have a report with multiple datasets, the first of which pulls in data based on user entered parameters (sales date range and property use codes). Dataset1 pulls property id's and other sales data from a table (2014_COST) based on the user's parameters. I have set up another table (AUDITS) that I would like to use in dataset6. This table has 3 columns (Property ID's, Sales Price and Sales Date). I would like for dataset6 to pull the Property ID's that are NOT contained in the results from dataset1. In other words, I'd like the results of dataset6 to show me the property id's that are contained in the AUDITS table but which are not being pulled into dataset1. Both tables are in the same database.

View 0 Replies View Related

Integration Services :: Perform Lookup On Large Dataset Based On A Small Dataset

Oct 1, 2015

I have a small number of rows in a dataset, Table 1.  There is a CLOB on a large dataset, Table 2.  They join on a PK.  I would like to retrieve this CLOB and add it to the data flow for Table1.  In short I want to emulate the following:

Table 1:  Small table without CLOB, 10 rows. 
Table 2: Large table with CLOB, 10,000,000 rows

select CLOB
from table2
where pk = (select pk from table1)

I want this to return the CLOBs for the small number of rows in Table 1.  The PK is indexed obviously so it should be a fast look up.

Table 1 and Table 2 live on different Oracle databases.  How do I perform this operation efficiently in SSIS?  It seems the Lookup and Merge Join wont do this.

View 2 Replies View Related

Reporting Services :: Populate One Dataset In SSRS Based On Results From Another Dataset Within Same Project?

May 27, 2015

I have a report with multiple datasets, the first of which pulls in data based on user entered parameters (sales date range and property use codes). Dataset1 pulls property id's and other sales data from a table (2014_COST) based on the user's parameters.

I have set up another table (AUDITS) that I would like to use in dataset6. This table has 3 columns (Property ID's, Sales Price and Sales Date). I would like for dataset6 to pull the Property ID's that are NOT contained in the results from dataset1. In other words, I'd like the results of dataset6 to show me the property id's that are contained in the AUDITS table but which are not being pulled into dataset1. Both tables are in the same database.

View 3 Replies View Related

How Can I Use SQL Reporting Services To Get A Dynamic Dataset From Another Web Service As My Reports Dataset?

May 21, 2007

I found out the data I need for my SQL Report is already defined in a dynamic dataset on another web service. Is there a way to use web services to call another web service to get the dataset I need to generate a report? Examples would help if you have any, thanks for looking

View 2 Replies View Related

How To Use A Variable As A Column Name?

May 25, 2008

 Hi, I want to use a variable and set it to column name but it just doesnt' workwhen I execute it. I got an error message "Invalid column name 'column1'. can you please help. ALTER PROCEDURE [dbo].[procedure_name]     @var1            INT = NULLAS    BEGIN        IF(@var1 = '-1')            BEGIN                --SET @var1 = column1            END    SELECT *    FROM table1    WHERE column1 = @var1   Thank you

View 4 Replies View Related

Column Name As Variable

Feb 25, 2001

Using a stored Procedure, I want to select a record from a Table if a certain string appears in a specified column, so I use

CREATE PROCEDURE spSearcher
@String varChar(20)
as
Select Column1, Column2, Column3 from Table1
where Charindex(@String1,Column1) > 0

which works fine.
But the following doesn't work:

CREATE PROCEDURE spSearcher
@String varChar(20)
@ColumnName VarChar(20)
as
Select Column1, Column2, Column3 from Table1
where Charindex(@String,@ColumnName) > 0


How can I substitute a variable for Column1, so I can pass the name Column1 or Column2, or Column3, as desired?

Thanks in anticipation,

Peter Caspersonn.

View 1 Replies View Related

Column As Variable

Jun 2, 2004

I have a problem that I'm sure is very simple to answer for anyone that knows a bit of T-SQL. In a stored procedure, I simply want to concatenate a string variable containing a column name into a Select statement.

For example:
I want to execute the following statement but using a variable for the column name:

Select * from tblmet1araw where JulianDay = 1


JulianDay is an integer
This is how I have my code set up:

declare @xxx as varchar(20)
set @theday = 'JulianDay'

select * from tblmet1araw where @theday = 1

I get the following error:
Server: Msg 245, Level 16, State 1, Line 4
Syntax error converting the varchar value 'JulianDay' to a column of data type int.

View 2 Replies View Related

Variable Column Name

Aug 11, 2006

Hi,

I have this query where I select data from the last 12 months (in 12 different columns).
What I would like to know is if it's possible to change the name of the columns to the month they refer to.

Thank's in advance,
AR

View 7 Replies View Related

Set Variable To Value In Column

Jul 26, 2007

Is it possible to set a variable in a stored procedure equal to avalue from a column when that column's respective ID is equal tomax(id)-1ID A B1 24 242 53 293 76 474 32 32What I am trying to do is update A in the last column to be equal to Bfrom the 4th row, plus A from the 3rd row. If I could set a variableequal to A in row 3 (in this case 76) I could easily add the variableto the existing value.I've tried something like this before. I'm sure some of you will sayright away, "of coarse that doesn't work". I'm new to sql.Set A = A + select( B from mytable where ID = (select (max(ID)-1) frommytable))where ID = (select (max(ID)) from mytable)ThanksMatt

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved