RowSampling: How To Dynamically Populate The Number Of Rows

Jan 24, 2006

I'm using the row sampling Transform to perform an A/B split on some data.

Is there anyway that I can dynamically populate the number of rows box ?

I currenlty have to find out the count, then divide it by 2 and manually enter this in to the box. It would be nice if there was a property associated with this that so that I could populate a variable with a count from a SQL query then associate this with the box using an expression.

Has anyone have any ideas how I can do this?

Also is there any other way of getting an A/B split of my data using SSIS or taking it one step further getting an A/B/C split..

Thanks for your help

View 3 Replies


ADVERTISEMENT

Populate Schema Name Dynamically

Jun 30, 2006

We are designing a server where functions and procedures are to be kept in a single database. Our other databases will call these functions. The functions will need to reference tables in the schema being called from. Is it possible to pass a schema name to a function? If so, then how?

I tried passing something like:


CREATE FUNCTION [dbo].[getPaymentReceived2](@inSchema CHAR(30), @inAraccountid CHAR(15), @inInvoicestart SMALLDATETIME)

RETURNS MONEY

AS

BEGIN

DECLARE @outAmt money

DECLARE @arinvoiceid char(15)

SET @arinvoiceid = (SELECT ai.arinvoiceid

FROM @inSchema.dbo.arinvoice ai

WHERE ai.araccountid = @inAraccountid

AND ai.invoicestart = DATEADD(month, - 1, @inInvoicestart))

I get an incorrrect syntax error.

View 6 Replies View Related

Dynamically Populate Flat File Connection String

Mar 12, 2008

Hi,
I tried to follow the widely talked about method to dynamically populate the connection string property of my flatfileconnection manager from a variable. I keep getting the following non-fatal error.

TITLE: Microsoft Visual Studio
------------------------------

Nonfatal errors occurred while saving the package:
Error at Package [Connection manager "FFCM"]: The file name ""C:ProjectsSSISHLoadTOutputOut.csv"" specified in the connection was not valid.

Error at Package: The result of the expression "@[User::CsvFullFileName]" on property "ConnectionString" cannot be written to the property. The expression was evaluated, but cannot be set on the property.


Here is what I am trying to do.
I have a foreach loop that iterates through a list of xml config files and reads the config information including the destination csv file name and does a data transformation.
So I created a flatfile connection to a csv file did my data mappings.
Created a package level variable to hold the destination file path
In the Flat file conn. manager's properties -> expression -> set the @[User::CsvFullFileName] (which even evaluates fine)

When I try to run the package I keep getting the above mentioned non-fatal error..I checked the path and it is valid. I even tried

the c:\projects\...notation and the UNC path notation...all seem to give the same error


Anyone experience this before ? any thoughts would be appreciated.

Thanks

View 5 Replies View Related

Re-populate A Unique Number Into Multiple Fields

Oct 14, 2004

What I need to do is re-populate a unique number into multiple fields,

Let me explain, An employee can appear in the first table only once but can be in the second table multiple times with multiple employee numbers .There is a field called TFN that is unique and we are using it to create a unique id called KRid so what I have done is created 2 tables namely TEST_TBL and TEST2_TBL . In TEST_TBL I am populating a KRid with a unique no being produced by the TFN field only once i.e 12345 being the resulting unique id number. If an employee has 2 employee numbers i.e empno 1 and empno 1000,only employee no 1 will have the unique KRid created but nothing for 1000 because the record already exists , so what has me stumped is that the TFN for employee empno 1 and the TFN for empno 1000 are the same. How do I get the KRid (12345 from empno 1) to populate empno 1000 in TEST2_TBL , The second table has all records in so I can group the second table by TFN id but how do I populate employee 1000 in the second table with the KRid 12345.


Please help!!!!! Below are how the tables are set up and an example of the result.

TABLE 1

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TEST_TBL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[TEST_TBL]
GO

CREATE TABLE [dbo].[TEST_TBL] (
[Empl_Num] [char] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Surname] [char] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[First_Name] [char] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Mid_Name] [char] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Hours_Day] [numeric](18, 2) NULL ,
[Hours_Wk] [numeric](18, 2) NULL ,
[KR_ID] [bigint] IDENTITY (1, 1) NOT NULL ,
[TFN] [char] (32) COLLATE Latin1_General_CI_AS NULL ,
[Date_Term] [datetime] NULL ,
[Empl_Type] [int] NULL ,
[Cost_Centre] [char] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Empl_Status] [int] NULL
) ON [PRIMARY]
GO

TABLE 2

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TEST2_TBL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[TEST2_TBL]
GO

CREATE TABLE [dbo].[TEST2_TBL] (
[EmpNumber] [char] (32) COLLATE Latin1_General_CI_AS NULL ,
[TFN] [char] (32) COLLATE Latin1_General_CI_AS NULL ,
[KR_ID] [char] (10) COLLATE Latin1_General_CI_AS NULL ,
[EmpStatus] [int] NULL ,
[EmpType] [int] NULL ,
[CommonName] [char] (32) COLLATE Latin1_General_CI_AS NULL
) ON [PRIMARY]
GO

Query goes as follows for table 1:

SELECT NPE000.EmpNumber, NPET00.RecordStatus, NPE000.KR_ID, NPE000.Surname, NPE000.FirstName, NPE000.SecondName, NPE000.Class, NPE000.DateEmployed, NPE000.DateOfBirth, NPE000.HoursPerDay, NPE000.HoursPerWeek, NPE000.PassportNo, NPE000.AwardCode, NPE000.EmailPayslipTo, NPE000.Location, NPE000.Grade, NPE000.DateTerminated, NPE000.EmploymentType, NPE000.DistCode, NPE000.EmpStatus, NPET00.TaxRefNo FROM NPE000 NPE000, NPET00 NPET00 WHERE NPET00.RecordStatus = 0 and NPET00.TaxRefNo <> ' 111111111' and NPET00.TaxRefNo <> ' 000000000' AND LENGTH(NPET00.TaxRefNo) >= 9 AND LENGTH(NPE000.KR_ID) >= 0 AND NPE000.EmpNumber = NPET00.EmpNumber


Query goes as follows for table 2:

SELECT NPE000.EmpNumber, NPE000.FirstName, NPE000.Surname, NPE000.Class, NPE000.Location, NPE000.EmploymentType, NPE000.EmpStatus, NPET00.TaxRefNo, NPE000.Paypoint, NPE000.KR_ID, FROM NPE000, NPET00 WHERE Recordstatus = 0 and (EmploymentType = 1 AND EmpStatus = 1 AND NPE000.EmpNumber = NPET00.EmpNumber


From this you can see that in table 1 it will only create 1 KR_ID for only one employee number but in table 2 I am bringing through all employee records. In table 2 I can group by NPET00.TaxRefNo which will bring all NPET00.TaxRefNo's togeather. From that I would like to populate the other employee numbers with the unique KR_ID.

Example:Table 1

000001,Jackson,James,Sam,7.6,38,12345,475431212


Example:Table 2

000001,Jackson,James,Sam,7.6,38,12345,475431212
001000,Jackson,James,Sam,7.6,38,,475431212

I hope this helps

Thanks in advance

View 10 Replies View Related

Is It Possible To Dynamically Populate A Parameter List With Values Based On Another Parameter Value?

Aug 11, 2005

Is it possible to fill a parameter list with values based on another parameter value?
Here's what I have so far (which hasn't worked)...
I'd like to generate a report listing information for a student.  The report viewer would first select a school from the first drop-down menu, and then the second drop-down menu would populate with the list of students at that school.
I have a dataset that calls a sp which returns a list of schools (SchoolID and SchoolName fields from the database table).
I have another dataset that calls a sp (with SchoolID as the parameter) which returns a list of students for that school.
Both datasets return the appropriate data when tested individually, but when I set up the Report Parameters and build the report, these errors come up...
The value expression for the query parameter '@SchoolID' refers to a non-existing report parameter 'SchoolID'.
The report parameter 'Student' has a DefaultValue or a ValidValue that depends on the report parameter "SchoolID".  Forward dependencies are not valid.
...Is it possible for the reoprt to generate a list of available parameter values based on the value selected for another parameter?
Any help you can give me would be great!!  Thank you

View 5 Replies View Related

SQL 2012 :: Populate Number With Leading Zeros To Make It As 5 Digits

Jan 23, 2015

Logic:ensure the Docket number is 5 digits and populate with leading zeros if not.I have to check input number field is 5 digits, if not I have to populate with leading zeros to make it as 5 digits.

View 2 Replies View Related

Populate Server Table Via HTTP Address And Port Number

Oct 15, 2015

How do I populate a SQL Server express 2014 table from an impinj speedway reader via http address and port number...

View 6 Replies View Related

SQL Server 2012 :: Populate Number Table Variation With Inline Tally?

Dec 27, 2014

I have to create a table like this across a bunch of servers. I'm thinking that I'm overlooking something with needing two additional CTEs, but maybe not. I have it at 17 seconds, which isn't much faster than a while loop solution that's currently in place.

DECLARE @START DATETIME,
@msg NVARCHAR(MAX) = N''
USE tempdb
SELECT @START = GETDATE()
CREATE TABLE dbo.EulerSource ( [SID] INT, Euler BIGINT )

[Code] ....

View 9 Replies View Related

How Do I Automatically Populate New Rows In 15 Child Tables?

Jun 20, 2006

When creating a new row or record in the Master table (by an Adapter update), how do I then populate new records in 15 different Child tables?

These Child tables are attributes of the Master table. I am sure there is more than one way to do this...

Thanks

View 3 Replies View Related

How To Enter More Number Of Rows In A Table Having More Number Of Columns At A Time

Sep 24, 2007

Hi

I want to enter rows into a table having more number of columns

For example : I have one employee table having columns (name ,address,salary etc )
then, how can i enter 100 employees data at a time ?

Suppose i am having my data in .txt file (or ) in .xls

( SQL Server 2005)

View 1 Replies View Related

SQL Server 2014 :: How To Split Phone Number Based On Symbol Dynamically

Jul 16, 2015

I would like to know how to split the phone number into two columns based on - symbol Dynamically.

for example

Phone Number
123-12323
1234-1222

so output should be

code number
123 12323
1234 1222

View 1 Replies View Related

Dynamically Select Rows From Last Month

Nov 9, 2014

This is my Statement.

SELECT a.FIRMA,
a.PSNR,
a.FELDNR,
a.PFLFDNR,
a.INHALT AS Cardnr,
a.PFGLTAB,

[Code] .....

But it deliver me also rows which are not in valid. I need only rows from last month from 01.10 until 31.10 and this rows are over the time. How can i select dynamically all row between 01.10 and 31.10 ?

FIRMAPSNRFELDNRPFLFDNRCardnrPFGLTAB PFGLTBISKSTNRPSPERSNRPSVORNAPSNACHNA
13980211DU9572014111220321231000043000957xxxxx xxxxxx
13990211DU9552014110120321231000010000955xxxxx xxxx
14030211DU9602014120120321231000086000960xxxxxxxxx

View 10 Replies View Related

Dynamically Trasnpose Rows Into Columns

Dec 10, 2005

I've seen several posts that begin to address this problem, but havenot found a simple, elegant solution that will accomplish this goal.The important part of this solution is that it must be completelydynamic - I have over 40 different categories of devices, each withdifferent fields, and each search will return only one category. Ihave no knowledge of the number or datatype of these field namesbeforehand and must use the sp to dynamically create the table and thentranspose the data.Here is an exampleI have normalized data in this format (this is a simplification)deviceId fieldName fieldValue1 color red1 shape square1 weight(kg) 2.02 shape round2 weight(kg) 1.53 color blue3 shape oval3 weight(kg) 1.0I would like to convert this to the format: (note that it must handlenulls - deviceId 2)deviceId color shape weight(kg)1 red square 2.02 round 1.53 blue oval 1.0Anyone with any thoughts on how best to accomplish this?thanks,Matt

View 19 Replies View Related

Column Name Or Number Of Supplied Values Does Not Match Table Definition When Trying To Populate Temp Table

Jun 6, 2005

Hello,

I am receiving the following error:

Column name or number of supplied values does not match table definition

I am trying to insert values into a temp table, using values from the table I copied the structure from, like this:

SELECT TOP 1 * INTO #tbl_User_Temp FROM tbl_User
TRUNCATE TABLE #tbl_User_Temp

INSERT INTO #tbl_User_Temp EXECUTE UserPersist_GetUserByCriteria @Gender = 'Male', @Culture = 'en-GB'

The SP UserPersist_GetByCriteria does a
"SELECT * FROM tbl_User WHERE gender = @Gender AND culture = @Culture",
so why am I receiving this error when both tables have the same
structure?

The error is being reported as coming from UserPersist_GetByCriteria on the "SELECT * FROM tbl_User" line.

Thanks,
Greg.

View 2 Replies View Related

Dynamically Binding Button And Controls On Table Rows.

Jun 15, 2007

Hi,



I am new to .NET world. I am using visual studio express.

I am developing website using ASP.NET and C#.



I want to add buttons dynamically on a table row on my web page.



For this I have written this code in "example.aspx" file







<asp:Table ID="tblExample" GridLines="Both" BorderWidth="1" runat="server" >



</asp:Table>







In my corresponding "example.aspx.cs" file i have written









TableRow tr = new TableRow();

.....................

.....................



TableCell tc3 = new TableCell();

tc3.Width = 120;

Button bt = new Button();

bt.Text = btnStop.Text;

bt.Width = 120;

bt.CommandArgument = lrs.IpAddress + ":" + lrs.PortNo;

bt.Click += new EventHandler(cmdStop_Click);

tc3.Controls.Add(bt);

tr.Cells.Add(tc3);



tblExample.Rows.Add(tr);













In my EventHandler "cmdStop_Click" I am trying to perform some action but on that particular row's data.



My page is also reloading after every 5 secs.



After clicking a button in a row, when page refreshes, I am getting this message in popup error message. also that entry is ommited(as per code in EventHandler)

______________________________________________________

"The Page cannot be refreshed without resending the information.

Click retry to resend the information again.

or click Cancel to return to the page that you were trying to view"



resetButton cancelButton

_______________________________________________________





How to bind that button to particular row so that when I click on a button the action should be performed on that particular row's data.







Thanks

View 1 Replies View Related

Integration Services :: Generate CSV File Dynamically With A Fixed Amount Of Rows

Jun 5, 2015

I need to generate a csv file from another csv file, seems to be simple but let's go the trick thing:

Needs to have maximum 1000 lines, if I reach to this, I need to create another csv and fill that new one.

Exemplifying:

I have a csv file called fileA and this has 2000 lines and another csv called fileB with 1500 lines.

I need to loop a folder and get the fileA, create an output called FileAOutput and start to fill that, if I reach to 1000 lines, I need to create a FileAOutput_2 and fill the other 1000 lines...so I'll go to fileB and do the same thing, but in the second case, I'll have 500 lines in the second output.

View 5 Replies View Related

Getting Number Of Rows

Sep 16, 2006

Is there a simple way to get the number of rows of a table besides going through and counting all of the rows programmatically?

View 13 Replies View Related

Number Rows

Mar 14, 2007

I have wrote a query that returns product details for all orders that are at stage 6. Is there a way to number the product lines in each order no?!

Eg.
Order 1
Product 1 - 1
Product 2 - 2
Product 3 - 3

--counter restarts
Order 2
Product 1 - 1
Product 2 -2

thanks?

View 2 Replies View Related

Number Of Rows.

Jun 20, 2008

Hi,
I have the following issue:

Here is my query:
The result is below:
(SELECT 'Succesful' AS metric_value,
SUM(CASE WHEN Product_Cat_Tier_3__2_ IN ('S Infr', 'S Entitl', 'S Provi') THEN 1 ELSE 0 end) AS S,
SUM(CASE WHEN Product_Cat_Tier_3__2_ IN ('Ading', 'Bending Floor', 'Net Ops' ) THEN 1 ELSE 0 end) AS N,
SUM(CASE WHEN Product_Cat_Tier_3__2_ IN ('Management NET', 'erprise') THEN 1 ELSE 0 end) AS ENTERP,
SUM(CASE WHEN Product_Cat_Tier_3__2_ LIKE '%Sector%' THEN 1 ELSE 0 end) AS TS,
SUM(CASE WHEN Product_Cat_Tier_3__2_ LIKE '%NMS%' THEN 1 ELSE 0 end) AS MS,
SUM(CASE WHEN Product_Cat_Tier_3__2_ = 'Fading' ) AR TS,
month(DATEADD(second, Actual_End_Date, '1969-12-31 8:00:00 PM')) as month
FROM Change

WHERE YEAR(DATEADD(second, Actual_End_Date, '1969-12-31 8:00:00 PM')) = YEAR(GETDATE()) AND

Product_Cat_Tier_1_2_ = 'Network' AND
Product_Cat_Tier_2__2_ = 'RFC' AND (Change_Request_Status = 11 and Status_Reason = 6000) AND
Product_Cat_Tier_3__2_ NOT IN ('Installation', 'Voice AND Video')
GROUP BY YEAR(DATEADD(second, Actual_End_Date, '1969-12-31 8:00:00 PM')), month(DATEADD(second, Actual_End_Date, '1969-12-31 8:00:00 PM'))
)

=====================
Result
================
metric_value S N ENTERP TS MS AR month
------------ -- -- ------ -- -- -- ----
Succesful 0 1 0 0 0 0 5
Succesful 0 1 1 0 0 0 6

And I want the following output, because now is June so month is equal to 6.
metric_value S N ENTERP TS MS AR month
------------ -- -- ------ -- -- -- ----
Succesful N N N N N N 1
Succesful N N N N N N 2
Succesful N N N N N N 3
Succesful N N N N N N 4
Succesful 0 1 1 0 0 0 5
Succesful 0 1 1 0 0 0 6

WHERE , N = NULL
THANK YOU

View 1 Replies View Related

Number Of Rows

Dec 27, 2006

Hello!

I try to figure out how to change the number of rows at each page, but I'm stuck.

I have no page break , but I get a number of pages when I view my report. Is there any way to set the number of rows shown at each page?

//Cissi

View 4 Replies View Related

Sql Help With Number Of Rows Return Value

May 14, 2008

hi,i have a stored procedure like this in SQL server ,it returns proper value if data is there for a given id.But if there is no data,it returns row/rows of NULL value and that is counted towards "number of row returned"..Shouldn't it be like,if there are null values in a row,that row should not be counted towards rows returned value .?Rightnow if no value returned from either of the select,it still returns as 2 rows instead of 0 rows.How do handle this situation in SQL? thanks for your help
SELECT     SUM(col1) AS SUM_COL1, SUM(col2) AS SUM_COL2, SUM(col3) AS SUM_COL3, SUM(col4) AS SUM_COL4FROM         TABLE1WHERE     (ID = nn)     UNION all
 SELECT      SUM(col22) AS SUM_COL22 ,cast(null as int) as c1,cast(null as int)as c2,cast(null as int) as c3FROM         table2WHERE     TABLE2 = nn)

View 1 Replies View Related

Set Number Of Returned Rows !!! Please Help Me.

Jun 3, 2004

I want to select data from a table with 5.000.000 rows. It's very slowly. Do you now, how I can select only a XY number of rows? I can't use TOP in select query. User see only 20-30 rows on his page, but he can use page_up, page_down. Is possible to something as lazy load?

View 2 Replies View Related

Number Of Rows Returned By Sp

Jul 9, 2004

Is it possible to get the number of Rows returned by a stored procedure in a profiler ?
if yes, what parameters shud I be looking for?

THanks

Harshal

View 7 Replies View Related

Count Number Of Rows In Asp.net

Nov 11, 2005

hey, how would i count the number of rows, with out using a loop??

thanks, Justin

View 2 Replies View Related

Get Number Of Rows Deleted

Feb 1, 2006

How do we get the number of rows deleted from a table?

@@rowcount is returning 0

View 2 Replies View Related

Discrepancy On Number Of Rows

Sep 18, 2006

Hi There,

Good Day :-)

How could I correct the erroneous value on the property window of an SQL Table.

My problem is that, if I am going to display the property window of Table1, the 'Rows' information displays 115. However, if I am going to execute - Select Count(*) from Table1 then it returns 117. How could I fix this glitch?

Please Help :-)

View 2 Replies View Related

Return Certain Number Of Rows

Apr 17, 2008

I have a Dataset that I am populating from a SQL Query. I am then using the dataset to populate a report in Reporting Services. What I want to do is return a standard number of rows in my dataset. (Let's say 10.) Even if my query does not have any rows in it, I want 10 empty rows returned to the dataset. If my query has 7 rows in it then I want to add on 3 empty rows and return it. I will not have more than the standard number of rows.
I cannot get the table in the report to show up if the dataset is empty, but still want the table to display with 10 empty rows. I have searched how to do this online but am getting nowhere. (I know how to add one empty row but not a set number.

View 6 Replies View Related

Selecting Top 'x' Number Of Rows Through A Sp

Jun 24, 2008

Hello all.

Im trying to write a stored procedure which i can stipulate the top number of rows it returns. I know i use the following syntax:

SELECT TOP 5

And i know i need to pass the number of rows i want as a variable to the stored proceudre like:


@Top as Integer

But when i try and do the following. SQL Server complains about the syntax:

SELECT TOP @Top

Can anyone advise me how i should be doing this?

View 3 Replies View Related

Selecting A Specified Number Of Rows

Jul 30, 2007

I know I can use "First" to specify a number of rows to return from a query but is it possible for the number of rows returned to be based on a parameter, something like this:

SELECT FIRST @someNumber name, age
FROM friends
WHERE age > @ageInput

View 3 Replies View Related

Number Of Rows In A Table

Nov 18, 2007

HI!
1.select count(*) from sales
2.select rows from sysindexes where id=object_id('sales') and indid<2

both queries return number of rows.
can anyone tell me which one is better?

View 2 Replies View Related

Very Large Number Of Rows

Jul 23, 2005

We are busy designing a generic analytical system at work that willhold multiple analytic types over time. This system is being developedin SQL 2000.Example of tableIDENTITY intItemId int [PK]AnalyticType int [PK]AnalyticDate DateTime [PK]Value numeric(28,15)ItemId - the item for which the analytic is being storedAnalyticType - an arbitrary typeThe [PK] tag indicates the composite primary key.Our scenario is the following:* For this time series data, we expect around 250 days per year(working days) and the dataset could extend to over 20 years* Up to 50 analytic types* Up to 20,000 itemsLooking at the combined calculation - this comes to roughly somethinglike25 * 20,000 * 50 * 250 or around 5 billion rows.We will be inserting around 50*20,000 or around 1 million rows each day(the inserts will take place in the middle of the night (outside themain query time) - this could be done through something like BCP orBULK INSERT.Our real problem is we have not previously worked with such largetables before and are nervous that our system is going to grind to ahalt. Our biggest tables are around 20 million rows at the moment.Scanning through google and microsoft's own site we have found aparititioning method that is available.http://www.microsoft.com/resources/...art5/c1861.mspxHaving experimented with the above system it seems rather quirky andlooking at the available literature it seems that this is not moreeffective than a clustered index as far as queries go.It needs to be optimized for queries like:Given the ItemID and the AnalyticType search for a specific date or aspecific range of dates.If anyone has any experience or helpful suggestions I would reallyappreciate it.ThanksA

View 4 Replies View Related

How To Count Number Of Rows

Jul 20, 2005

Hello, DeanTry this:select distinct c1, c2 into #tmp_1 from t1select count(*) as cnt from #tmp_1drop table #tmp_1With best regards.

View 1 Replies View Related

Large Number Of Rows.

Apr 3, 2007

Hi all,



A select query returns around 1 million rows. The column in the WHERE condition is indexed. This query takes nearly 1 minute for returning the all the records. Is this normal ?



Does the number of records returned affect the performance inspite of the indexing ?



Thanks,



DBLearner

View 3 Replies View Related







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