Showing posts with label values. Show all posts
Showing posts with label values. Show all posts

Thursday, March 29, 2012

Creating an asynchrous output

Are there any good examples creating an asychronous output. I need to be able to output the values from the input as well as adding 7 new columns to each row.

http://msdn2.microsoft.com/en-us/library/ms136133.aspx

The answers are available, you just need to search for them. I found the link above by typing "asynchronous component code ssis" into Google.

-Jamie

|||

Also, be aware that just because you need to add columns to a row does not mean that you need to use an async output. You need to use an async output only if you need to hold onto data longer that the ProcessInput call or if you need to generate more rows going out than coming in. Generally, if one of those 2 conditions don't apply then you can use a sync output, which I would highly recommend because it is significantly simpler.

HTH,

Matt

|||

Matt David wrote:

Also, be aware that just because you need to add columns to a row does not mean that you need to use an async output. You need to use an async output only if you need to hold onto data longer that the ProcessInput call or if you need to generate more rows going out than coming in. Generally, if one of those 2 conditions don't apply then you can use a sync output, which I would highly recommend because it is significantly simpler.

HTH,

Matt

And it executes quicker!

Creating an associative table using SQL as values change ....

I have a table in a database however there are no pk-fk relationships in the
schema.
So i need to create a view/temp table which relates the Sublevels to the Top
Level values.
For example, i have the following table:
Name LV_Level LV_ID
Admin 1 1
HR 1 8
Ops 1 11
Issuer 2 12
Acquirer 2 13
. . .
. . .
Shared Serv 1 19
Finance 2 20
Facilities 2 21
Legal 2 22
The level 2s and greater indicate sublevels to the level 1.
What i need to be able to do is create a hierarchy so that Issuer (2) and
Acquirer (2) belong to Ops (Level 1, ID 11)
and that Finance (2), Facilities (2) and Legal (2) belong to Shared Serv
(Level 1, ID 19).
The LV_ID gets renumbered as new values in the Application are added to the
database. There is another column not shown that acts a pk/uid, but there is
no relationship in this table other than a sequential renumbering of LV_ID.
So if i add anouther value under Ops, Shared Serv may get renumbered to 20
and all the items below it are renumbered as well.
I need to be able account for growth in the tables are new values are added.
I was thinking of something along the results of:
LV_ID Level_Reports_to
1 1
8 8
11 11
12 11
13 11
19 19
20 19
21 19
22 19
I've tried various ways and am not accomplishing the results above.
Any hints on syntax in SQL would be appreciated.On Tue, 13 Sep 2005 08:01:56 -0600, TroyS wrote:

>I have a table in a database however there are no pk-fk relationships in th
e
>schema.
Hi TroyS,
Fix that first, please. Every table should have a primary key. Every
relationship should be enforced by a FK constraint. Omitting that basic
rule of relational databases is asking for garbage in your data.

>So i need to create a view/temp table which relates the Sublevels to the To
p
>Level values.
>For example, i have the following table:
(snip)
>I need to be able account for growth in the tables are new values are added
.
>I was thinking of something along the results of:
>LV_ID Level_Reports_to
>1 1
> 8 8
>11 11
>12 11
>13 11
>19 19
>20 19
>21 19
>22 19
>I've tried various ways and am not accomplishing the results above.
>Any hints on syntax in SQL would be appreciated.
I'm not sure if this is the best way to store your data, though I'm very
sure that it's a whole lot better than your current way!
Order a copy of Joe Celko's Trees and Hierarchies in SQL For Smarties
now, and read it when you have it to find out all you want to know (and
more) about good and bad ways to model this kind of data.
Anyway, for now I'll give you a query that will hopefully convert your
current mess in the somewhat better version you're asking for:
INSERT INTO BetterTable (LV_ID, Level_Reports_to)
SELECT a.LV_ID,
CASE
WHEN a.LV_Level = 1
THEN a.LV_ID
ELSE (SELECT MAX(b.LV_ID)
FROM BadTable AS b
WHERE b.LV_Level = 1
AND b.LV_ID < a.LV_ID)
END
FROM BadTable AS a
(Untested - see www.aspfaq.com/5006 if you prefer a tested version).
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Hugo,
thx for the info
I realize the schema is flawed, however, this isn't an appl i'm writing.
it's a 3rd party,commercial appl and therefore i can't change the
schema.
If the schema had pk-fk relationships, then i wouldn't need some
help...
i will take a look at the query...thx for the help.
*** Sent via Developersdex http://www.examnotes.net ***

Thursday, March 22, 2012

Creating a table from the Rows of Other table

How can I create table from the rows of other table?

My requirement is I have a table test which has a column Abc with some values say a,b,c,d,e

Is it possible to create a table which has the column names as a,b,c,d,e...

Since the rows in the test table are dynamic...is it possible to create a table with the dynamic columns?

Any pointers in this regard?

Yes.. You can do this. Use INTO clause on your Select Statement.

Select A,B,C,D,E INTO NEWTABLE from ABC

|||

Thanks Sekaran.

But my problem is I am not sure the number of rows in my first table.

i,e if I do Select * from temp and it it returns 10 rows then those 10 rows should be the column names in my second table.and if there are only 5 rows then my second table should have 5 columns only.

|||

Ok.. You want to create table using your Rows..

I am not sure why you need this.. This is not good idea to create a table on the fly.

Are you want to convert the Row wise data into column? Something like PIVOT table.

Give more info...

|||

tried with PIVOT it doesnt seem to work out .. as i dont have an INTEGER on which i can pivot

and i dont know what would my for() will have.

see this is my case:

I've a table A with columns a1,a2,a3

i've table B with column b1 and values a4,a5 (offcourse the number of rows in b1 always vary)

select a1,a2,a3 from A

pivot

max(?)

for ([?],[?].....)

order by ?

and above all.....I'm just trying to create the schema and surely not going for the population at this moment

awaiting for your quick reply

|||

I've a table A with columns a1,a2,a3

i've table B with column b1 and values a4,a5 (offcourse the number of rows in B always vary)

and my resulting table C should be having a1,a2,a3,a4,a5 columns

|||

If I understand you want the table to have the same schema as table A but in addition to also have the data values in table B as additional columns?

The only way I can think is to create the table using dynamic sql using syscolumns to generate the first part of the SQL and then cursoring through the datavalues in table be to generate the remaining SQL.

I'm not sure why you would do this but if you need to then I suggest that you strictly control the entries in table B.

|||

Thanks Sunny,

But there is no way that I can restrict the entries in table B. But at the max there will be 30-40 rows which needs to be changed as the header for other report.

Can trigger help me in my case?

|||

Still your problem is not clear, help us understand in better way.

Pls put some proper sample data rather A,B,C & a1, a2 ...

Its confusing buddy..

|||

Here is the example code:

Create table Meta(Columnname varchar(20))

Insert into Meta values('EmpNo')

Insert into Meta values('EmpName')

Insert into Meta values('Address')

Now if I do select * from Meta the result will be

EmpNo

EmpName

Address

Then I have another table Employee with two columns(Tel# ,SSN)

So my requirement is to change the schema of Employee table as (EmpNo,EmpName,Address,Tel#,SSN)

This is just an example as the number of rows in the Meta table is not known.

|||

Ok. You want to change the database (table) structure when you insert any new column on META table.

I don't recommand this. This is not a good practice at all.

If there is any schema change it should be done via proper script & by one hand(most of the time DBA).

I am really not sure why this dangerous logic you took in your hand.

If you ask me strightly its possible to do via trigger... But take care, take care on Update/Delete of your META data.

You may mess-up lot of dependent SPs, Views, Functions & even on your UI .

Create Trigger Meta_Trigger On Meta

For Insert

as

Begin

Declare @.Q as varchar(1000);

Select @.Q ='Alter Table Employee Add ' + ColumnName + ' Varchar(1000)' From Inserted;

Exec(@.Q)

End

|||

sekharan....how will i get the "columnname" in the above case

my problem was always getting the variable name here!!!

|||Whenever you insert the new column from your variable to the Meta table the trigger will find the newly inserted value using the INSERTED spl table...

Creating a table

I have a recordset that consists of among other things a list of values and
dates over the next 12 months, I want to display these dates in a table
ie
Jan Feb Mar Apr May Jun etc
12 80 120 5 65 56 etc
The months are on a 12 month rolling table, how would i achieve this,
perhaps using a case statement or ?
thanks in anticipation
JohnYes, I would do that to. Due to the fact that there will be no more
month (names) in the future this should be an appropiate solution. If
the tables is VERY big and the values seldom change in that table and
the query time must be fast you should thing about (if they are
aggregatable) using AS for this. This could speed up your performance
and let you (with the help of a time dimension) give you the possibilty
to aggregate the values fast from different views.
HTH, jens Suessmeyer.|||Can you give me some pointers of how to acheive this please ?
"Jens" <Jens@.sqlserver2005.de> wrote in message
news:1137772267.696338.62730@.g49g2000cwa.googlegroups.com...
> Yes, I would do that to. Due to the fact that there will be no more
> month (names) in the future this should be an appropiate solution. If
> the tables is VERY big and the values seldom change in that table and
> the query time must be fast you should thing about (if they are
> aggregatable) using AS for this. This could speed up your performance
> and let you (with the help of a time dimension) give you the possibilty
> to aggregate the values fast from different views.
> HTH, jens Suessmeyer.
>|||Sure, do you need information for AS or the setbased solution ? For the
set based solution it would be interesting to get some DDL and sample
data from your database. http://www.aspfaq.com/5006, otherwise a
generic solution would be
SELECT
CASE MONTH(DateColumn)
WHEN 1 THEN SUM(SomeValue) END As January (...)
HTH, jens Suessmeyer.

Wednesday, March 7, 2012

Creating a filter on a Dataset

Can I create a report parameter label list to only show the values
that have been extracted wthin a field in my dataset?
i.e. in the same way you add an autofilter on a column in excel, to
return the values in that column.You would need to have a second dataset. Make it exactly the same except use
the distinct and just the single field you care about.
Of course if you are doing this, then your main dataset should take this and
use it as a query parameter so return as little data as possible. Stay away
from filters as much as possible.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Andy" <andywilliams1971@.msn.com> wrote in message
news:17287b26-fbc2-4442-a6f2-ba6cfdd83718@.u10g2000prn.googlegroups.com...
> Can I create a report parameter label list to only show the values
> that have been extracted wthin a field in my dataset?
> i.e. in the same way you add an autofilter on a column in excel, to
> return the values in that column.

Friday, February 24, 2012

Creating a cached instance of a report for all variable values

I have a report that takes quite some time to render.
So I would like to create cached-instances of the report for each possible
variable value.
I suppose this is a rather common problem. Is there a solution (script,
program) available somwhere to do this?
(I've tried some things with the scripts but I can't get it to work, I keep
geeting "timed out' errors (although de report execution is set not to time
out) or security exeptions (althoug my user is a RS system user with all the
authoroty))
Thank youDid you ever figure out how to do this?
We thought that creating a data-driven subscription that dumped the report
to a file share when the report was setup to be cached would cache all
possible versions of the report, but we're finding that it's not caching
those executions and the report is being rendered on the first request.
Any thoughts?
Thx, Joel
"Antoon" <Antoon@.discussions.microsoft.com> wrote in message
news:CFFBE8A3-1C94-4FC7-8280-3F68E4ECD19F@.microsoft.com...
>I have a report that takes quite some time to render.
> So I would like to create cached-instances of the report for each possible
> variable value.
> I suppose this is a rather common problem. Is there a solution (script,
> program) available somwhere to do this?
> (I've tried some things with the scripts but I can't get it to work, I
> keep
> geeting "timed out' errors (although de report execution is set not to
> time
> out) or security exeptions (althoug my user is a RS system user with all
> the
> authoroty))
> Thank you|||I did, but it's a workaround. I've written a small programme in VB.net
that will take the name of the report and the parameters and that will
render the report in a web-window for each possible combination of the
parameters.
This does the trick, but it's not what you would call "elegant", I hope MS
will solve this in the next version.
"Joel Rumerman" wrote:
> Did you ever figure out how to do this?
> We thought that creating a data-driven subscription that dumped the report
> to a file share when the report was setup to be cached would cache all
> possible versions of the report, but we're finding that it's not caching
> those executions and the report is being rendered on the first request.
> Any thoughts?
> Thx, Joel
> "Antoon" <Antoon@.discussions.microsoft.com> wrote in message
> news:CFFBE8A3-1C94-4FC7-8280-3F68E4ECD19F@.microsoft.com...
> >I have a report that takes quite some time to render.
> > So I would like to create cached-instances of the report for each possible
> > variable value.
> > I suppose this is a rather common problem. Is there a solution (script,
> > program) available somwhere to do this?
> >
> > (I've tried some things with the scripts but I can't get it to work, I
> > keep
> > geeting "timed out' errors (although de report execution is set not to
> > time
> > out) or security exeptions (althoug my user is a RS system user with all
> > the
> > authoroty))
> >
> > Thank you
>
>

Sunday, February 19, 2012

CreateSubscription with a shared schedule

In BOL I read that The valid values for the EventType argument of CreateSubscription are TimedSubscription or SnapshotUpdated.
What if I want to use an existing shared schedule, which in the reportserver database appears as type SharedSchedule? Do I still use TimedSubscription?
And how can I serialize the schedule object in order to get the xml used in CreateSubscription attribute MatchData?
In other words, how do I use an existing shared schedule with CreateSubscription? Are there any other examples, apart from the one in BOL?Try to send the SbuscriptionID of your shared schedule in the matchdata
parameter (without any XML tag)
"vsiat" <vsiat@.discussions.microsoft.com> a écrit dans le message de
news:EF725471-5320-444D-9144-5305E10ADC07@.microsoft.com...
> In BOL I read that The valid values for the EventType argument of
CreateSubscription are TimedSubscription or SnapshotUpdated.
> What if I want to use an existing shared schedule, which in the
reportserver database appears as type SharedSchedule? Do I still use
TimedSubscription?
> And how can I serialize the schedule object in order to get the xml used
in CreateSubscription attribute MatchData?
> In other words, how do I use an existing shared schedule with
CreateSubscription? Are there any other examples, apart from the one in BOL?
>|||For a subscription to use a shared schedule, pass in TimedSubscription for
the eventType and the schedule ID for the match data. You can get the
schedule ID by calling listSchedules.
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jéjé" <willgart@._A_hAotmail_A_.com> wrote in message
news:OL8Xs1dXEHA.1048@.tk2msftngp13.phx.gbl...
> Try to send the SbuscriptionID of your shared schedule in the matchdata
> parameter (without any XML tag)
>
> "vsiat" <vsiat@.discussions.microsoft.com> a écrit dans le message de
> news:EF725471-5320-444D-9144-5305E10ADC07@.microsoft.com...
> > In BOL I read that The valid values for the EventType argument of
> CreateSubscription are TimedSubscription or SnapshotUpdated.
> >
> > What if I want to use an existing shared schedule, which in the
> reportserver database appears as type SharedSchedule? Do I still use
> TimedSubscription?
> >
> > And how can I serialize the schedule object in order to get the xml used
> in CreateSubscription attribute MatchData?
> >
> > In other words, how do I use an existing shared schedule with
> CreateSubscription? Are there any other examples, apart from the one in
BOL?
> >
>

CreateSubscription parameter array problem

I'm using the CreateSubscription method and having a problem with the
parameter values getting rejected. I am wondering if I am experiencing a
type conflict because my report parameters are all integers but from the
samples it looks like I may need to define them as strings. Is there a
limitation on using this web service method that your report parameters must
all be strings?
The error I am getting is not that helpful:
The value of parameter 'Parameters' is not valid. Check the documentation
for information about valid values. --> The value of parameter 'Parameters'
is not valid. Check the documentation for information about valid values.
I am building the parameter array like this:
Dim parameters(4) As ParameterValue
parameters(0) = New ParameterValue()
parameters(0).Name = "PriorMonthEndAsOfDateDimensionId"
parameters(0).Value = "353"
parameters(1) = New ParameterValue()
parameters(1).Name = "MonthEndAsOfDateDimensionId"
parameters(1).Value = "419"
parameters(2) = New ParameterValue()
parameters(2).Name = "StrategyDimensionId"
parameters(2).Value = "98"
parameters(3) = New ParameterValue()
parameters(3).Name = "FundDimensionId"
parameters(3).Value = "847"
I get the same error if I assign the values without the quotes.
Thanks,
SimonI'm an idiot.
I was defining the array incorrectly. When I change it to: Dim
parameters(3) As ParameterValue
it works.
Sorry.
"Simon Schmidt" wrote:
> I'm using the CreateSubscription method and having a problem with the
> parameter values getting rejected. I am wondering if I am experiencing a
> type conflict because my report parameters are all integers but from the
> samples it looks like I may need to define them as strings. Is there a
> limitation on using this web service method that your report parameters must
> all be strings?
> The error I am getting is not that helpful:
> The value of parameter 'Parameters' is not valid. Check the documentation
> for information about valid values. --> The value of parameter 'Parameters'
> is not valid. Check the documentation for information about valid values.
> I am building the parameter array like this:
> Dim parameters(4) As ParameterValue
> parameters(0) = New ParameterValue()
> parameters(0).Name = "PriorMonthEndAsOfDateDimensionId"
> parameters(0).Value = "353"
> parameters(1) = New ParameterValue()
> parameters(1).Name = "MonthEndAsOfDateDimensionId"
> parameters(1).Value = "419"
> parameters(2) = New ParameterValue()
> parameters(2).Name = "StrategyDimensionId"
> parameters(2).Value = "98"
> parameters(3) = New ParameterValue()
> parameters(3).Name = "FundDimensionId"
> parameters(3).Value = "847"
> I get the same error if I assign the values without the quotes.
> Thanks,
> Simon

CreateSubscription Extension Parameters

The following Extension Parameters are not being accepted --
CreateSubscription works and a record is created, but three values are not
getting through to the database:
extensionParams(3) = New
rsSubscriptions.SVR03_ReportService.ParameterValue
extensionParams(3).Name = "RENDERFORMAT"
extensionParams(3).Value = pReportType
extensionParams(4) = New
rsSubscriptions.SVR03_ReportService.ParameterValue
extensionParams(4).Name = "WRITEMODE"
extensionParams(4).Value = "AutoIncrement"
extensionParams(5) = New
rsSubscriptions.SVR03_ReportService.ParameterValue
extensionParams(5).Name = "UserName"
extensionParams(5).Value = "myuserid"
extensionParams(6) = New
rsSubscriptions.SVR03_ReportService.ParameterValue
extensionParams(6).Name = "PassWord"
extensionParams(6).Value = "mypassword"
The "WRITEMODE" is the only of the above Extension Parameters that is
correct when I go into the detail screen. The format says "XML file with
report data" (the default) and the Userid and Password are blank.
Everything else is working great.
Any suggestions? I tried all-caps for the Param.Name (as they display coming
out of the ListSubscriptions method), but that made no difference.
Thanks!
AJThere isn't much documentation that I found that tells you exactly how
the name should be spelled, so I used this code:
rs.GetDataDrivenSubscriptionProperties(subscriptionID, out exSet,
out dataPlan, out desc, out aState, out status,
out eventType, out matchData, out parameterVal);
ParameterValue param =(ParameterValue)exSet.ParameterValues.GetValue(3);
lblName.Text = param.Name.ToString();
To get the names (you just change the number in GetValue). Here is
what I found from this:
FILENAME
FILEEXTN
PATH
RENDER_FORMAT
USERNAME
WRITEMODE
In addition, trial and error has shown me that:
PASSWORD
is what RS is expecting for the password.
Try using these EXACTLY as shown here and see if it helps.
Sheridan Saint-Michel|||Thanks, Sheridan,
I went back and checked my test matrix and realized that I hadn't tested
case-sensitivity on that parameter name. It appears that CreateSubscription
will load Extension Parameters into the database even if they are incorrect,
and this was throwing me off.
I've now loaded my (hundreds) of new report requests and the schedule is
running!
AJ.
"Sheridan" wrote:
> There isn't much documentation that I found that tells you exactly how
> the name should be spelled, so I used this code:
> rs.GetDataDrivenSubscriptionProperties(subscriptionID, out exSet,
> out dataPlan, out desc, out aState, out status,
> out eventType, out matchData, out parameterVal);
> ParameterValue param => (ParameterValue)exSet.ParameterValues.GetValue(3);
> lblName.Text = param.Name.ToString();
> To get the names (you just change the number in GetValue). Here is
> what I found from this:
> FILENAME
> FILEEXTN
> PATH
> RENDER_FORMAT
> USERNAME
> WRITEMODE
> In addition, trial and error has shown me that:
> PASSWORD
> is what RS is expecting for the password.
> Try using these EXACTLY as shown here and see if it helps.
> Sheridan Saint-Michel
>|||I am having the same issue but with only PASSWORD though. all of my other
info is being passed. here is my code. any suggestions?
ParameterValue[] extensionParams2 = new ParameterValue[7];
extensionParams2[0] = new ParameterValue();
extensionParams2[0].Name = "FILENAME";
extensionParams2[0].Value = ScheduleName;
extensionParams2[1] = new ParameterValue();
extensionParams2[1].Name = "FILEEXTN";
extensionParams2[1].Value = "true";
//check if folder exists for User. If not then create
string strPath =ConfigurationManager.AppSettings["ReportsSchedulePath"].ToString()+ UserName;
if (!System.IO.Directory.Exists(strPath))
{
System.IO.Directory.CreateDirectory(strPath);
}
extensionParams2[2] = new ParameterValue();
extensionParams2[2].Name = "PATH";
extensionParams2[2].Value = strPath;
extensionParams2[3] = new ParameterValue();
extensionParams2[3].Name = "RENDER_FORMAT";
extensionParams2[3].Value = ReportType;
extensionParams2[4] = new ParameterValue();
extensionParams2[4].Name = "WRITEMODE";
extensionParams2[4].Value = "AutoIncrement";
extensionParams2[5] = new ParameterValue();
extensionParams2[5].Name = "USERNAME";
extensionParams2[5].Value =ConfigurationManager.AppSettings["FileShareUser"].ToString();
//extensionParams2[6] = new ParameterValue();
//extensionParams2[6].Name = "PASSWORD";
//extensionParams2[6].Label = "PASSWORD";
ParameterValue PW = new ParameterValue();
PW.Name = "PASSWORD";
PW.Value = ConfigurationManager.AppSettings["FileSharePass"].ToString();
//extensionParams2[6].Value =ConfigurationManager.AppSettings["FileSharePass"].ToString();
extensionParams2.SetValue(PW, 6);
ExtensionSettings extensionSettings2 = new ExtensionSettings();
extensionSettings2.Extension = "Report Server FileShare";
extensionSettings2.ParameterValues = extensionParams2;
string matchData = XML;
string txtResults2;
txtResults2 = schReport.CreateSubscription(ReportPath(),
extensionSettings2, ScheduleName, "TimedSubscription", matchData, paramaters);
return txtResults2;
also this worked when i first implimented this but has recently stopped
working. any security issues i should look at? i have SP1 and SP2 put on
Reporting services.
Josh