Showing posts with label solution. Show all posts
Showing posts with label solution. Show all posts

Sunday, March 11, 2012

Can SSIS work with an XML web service? (Verisign Payflow Pro)

I'm trying to figure out a solution for posting financial transactions against our Payflow Pro (Verisign) payment gateway (web service) using SSIS. The process I have in my mind goes like this...

1.) Select the appropriate records from our financial system DB.

2.) Iterate through each record and post the pertinent values against the payment gateway web service.

3.) Create log files for successful and failed transactions.

The log files would then be manually imported into our financial system.

Thanks in advance.

There is no web service or XML data flow destination, unfortunately. You could write a custom destination component to call your web service.|||

jwelch wrote:

There is no web service or XML data flow destination, unfortunately. You could write a custom destination component to call your web service.

Not entirely true... You can stick a Web service task in a foreach loop that spins through the recordset. Then you merely map the appropriate variables to the Web service.

This is done on the control flow, though, so you'd need to perhaps stage your data first in the data flow and then select it with an Execute SQL task to load up your ADO recordset.|||My bad, I was focused on the data flow. Good approach.|||Great info! I'll look into that.

Can SubReports be from SubProjects in the same solution

We have a bunch of small single pupose reports (individual charts, tables, etc.) that we used as subreports across several larger reports. I want to sperate the subreports into their own folder on the Reporting Server and I tried to tdo this by creating a solution with subprojects and specifying different publishing folders. That seems to be going well, but when I want to add a subreport from one project to a report in another project Visual Studio doesn't seem to like this at all. It won't let me drag them to the layout surface.

Shoudl this work? Is there something different I need to be doing since I'm working with multiple projects now?

Thanks,

-p

I'm not sure it's going to work that way -- somebody else will have to confirm, not really my area -- but, if it does not, could you create a custom post-build step that copied the RDLs from their source folders to where they needed to go within each individual project?

I realize it's not ideal to replicate the files, but this would keep them up to date/synched.

>L<

|||

Actually -- one more thought -- I'm not sure if this utility will do what you want, but it looks like it might -- you could check it out...

http://www.sqldbatips.com/showarticle.asp?ID=73

>L<

|||

That tool is for taking one report and publising it multiple places. I want to do the exact opposite publish a set of subreports to one location and reuse them in another. The idea being that then people don't have to see the noise of all the subreports we can just use the nice well formatted project reports which include a variety of subreports as needed.

I don't think a post-build script would be very easy to maintain (or even possible) it seems that the subreport control can't refer to a report outside of its own namespace (i.e., its own folder).

|||

I understand what the tool does, and in essence the post-build script I suggested does the same thing, I just thought the tool would be more "automatic".

What I did *not* understand was why you wanted to do it (the "noise" of the subreports) -- I thought it was a maintenance issue. IOW, let's assume (as we both think so far) that a subreport can't refer to a report "somewhere else". Since we don't have control over that, both the tool and the postbuild at least make sure you don't have to *update* all the copies of a single subreport that you've had to "litter" all of your projects with, if changes have to be made.

I agree with you 100% about the "noise/litter" issue and I wish I had a better solution to offer.

FWIW, I have a similar problem: I wanted to set different deployment folders for different reports in a *single* project <shrug>. Yes I know you can do this in different configurations. I want to have my "Production" configuration deploy all reports to the same server, but different locations on that server. IOW, I would like to have a single reporting project that serves a whole bunch of different departments, each of which has a different reporting folder with its own set of permissions assigned to it.

I suspect the problems are connected. IOW, if it's really true that reports can only reference other reports in one folder, then if you could deploy the way I want to it would break the subreport references...

>L<

|||

Interesting note:

You can specify project interdependance, among subprojects, which implies that one subproject can reference another somehow. (otherwise, why would you need to set one project to be dependant on another)

|||

Of course one project can reference another <s>. That applies when (say) I build a report that references a custom code DLL or -- more commonly in my case -- I build a solution that has some black box code in C# and white box code in VB.

The "somehow" is by instancing classes from other DLLs...

I think what we've been saying in this thread is that, if the same applies to different *report* projects, we don't understand how it works and haven't gotten it to work the way we might have expected it to.

As an example, and one we haven't discussed in this thread yet: suppose I create a second report project in a solution and make it dependent on my first report project. When I want to create a report, can I use a shared data source from the first project? As far as I know... not. FWIW: I have tried referencing the shared datasource in a "solution folder" but that doesn't seem to do the trick.

>L<

|||

Ah, I had wondered what it was for. I have not delved much into custom code for RS yet. I am still primarily a SQL person.

The only solution I have found thus far is to use Source Safe to share my subreports between projects, ala the tool mentioned previously.

To get around the messy listings all these subreports creates, we're building a simple web front end to redirect the users to the correct report.

|||

I have one big project,

within that I have sub projects that publish the reports under them to a different folder on the report server... something like..

Accounts Receivable.

AR Reports

Accounts Payable

AP Reports

etc...

Data Sources has it's own folder.

If I have a AR subreport I want to share with other reports in that folder I simply share them.

If you are going to have a sub report span multiple projects then you need to copy the sub report from one project to the other which in vs2005 is simple as highlighting the sub report, ctrl-c then goin to your other project and press ctrl-v.

you can also have a sub folder in your main folder to hold sub reports.

lots of ways to do it.

|||

You can have one solution and multiple sub projects and have each sub project publish to a different server and/or folder, That seems to work just fine and I think as long as there was no overlap in the reports it would meet your needs.

For reports you want to put in multple locations you'd either need to use the tool you reccomended or copy the report into each project as a later poster reccomends.

I think we're all in agreement that there is no way (or we don't know how) to have a subreport be from a different project than the main report.

Anyway, I guess I'll go back to a single project and make up some clever naming schema so the main reports are at the top of the list and the subreports are at the bottom OR mark the subreports as Hidden. I've not played much with that. I hope I can do that from Visual Studio or if not that when I set it in the Web UI its not overwritten each time I deploy.

Thanks,

-p

|||

Are you letting your users see the reportserver directory as it stands?

You might want to consider doing a little webpage that reads a table that lists where the reports are.

My company has implemented this type of thing.

We have a webpage where the user selects which report group they want and then hit a button and get a list of reports that match...

It is two tables, a group table and a reports table. inthe reports table we have a friendly name for the report and the location to where it is..

works fine for us and the users NEVER see what we don't want them to.

|||

The Original querstion was not answered, but I worked around this by keeping all of the reports in one project and then marking the sub reports as Hidden on the server side.

This setting is preserved even after you re-dpeloy a report. Kind of hard to setup, but bearable.

I wish the original method of using projects with different target folders woudl work though, that would be best.

|||

If I understand your original question correctly, you can use a report from a different project as a subreport.

Let's say that your subreport is "MySubReport.rdl" in project "MyProjectA" and you want to use it from a project in "MyProjectB". Both projects have the same TargetServerURL and the same parent folder (e.g. TargetReportFolder is set to "MySolution/MyProjectA" and "MySolution/MyProjectB").

In Report Designer, drag and drop a subreport item onto your report. Set its subreport property to "./../MyProjectA/MySubReport" and manually set any parameters.

Hope this helps.

Can SubReports be from SubProjects in the same solution

We have a bunch of small single pupose reports (individual charts, tables, etc.) that we used as subreports across several larger reports. I want to sperate the subreports into their own folder on the Reporting Server and I tried to tdo this by creating a solution with subprojects and specifying different publishing folders. That seems to be going well, but when I want to add a subreport from one project to a report in another project Visual Studio doesn't seem to like this at all. It won't let me drag them to the layout surface.

Shoudl this work? Is there something different I need to be doing since I'm working with multiple projects now?

Thanks,

-p

I'm not sure it's going to work that way -- somebody else will have to confirm, not really my area -- but, if it does not, could you create a custom post-build step that copied the RDLs from their source folders to where they needed to go within each individual project?

I realize it's not ideal to replicate the files, but this would keep them up to date/synched.

>L<

|||

Actually -- one more thought -- I'm not sure if this utility will do what you want, but it looks like it might -- you could check it out...

http://www.sqldbatips.com/showarticle.asp?ID=73

>L<

|||

That tool is for taking one report and publising it multiple places. I want to do the exact opposite publish a set of subreports to one location and reuse them in another. The idea being that then people don't have to see the noise of all the subreports we can just use the nice well formatted project reports which include a variety of subreports as needed.

I don't think a post-build script would be very easy to maintain (or even possible) it seems that the subreport control can't refer to a report outside of its own namespace (i.e., its own folder).

|||

I understand what the tool does, and in essence the post-build script I suggested does the same thing, I just thought the tool would be more "automatic".

What I did *not* understand was why you wanted to do it (the "noise" of the subreports) -- I thought it was a maintenance issue. IOW, let's assume (as we both think so far) that a subreport can't refer to a report "somewhere else". Since we don't have control over that, both the tool and the postbuild at least make sure you don't have to *update* all the copies of a single subreport that you've had to "litter" all of your projects with, if changes have to be made.

I agree with you 100% about the "noise/litter" issue and I wish I had a better solution to offer.

FWIW, I have a similar problem: I wanted to set different deployment folders for different reports in a *single* project <shrug>. Yes I know you can do this in different configurations. I want to have my "Production" configuration deploy all reports to the same server, but different locations on that server. IOW, I would like to have a single reporting project that serves a whole bunch of different departments, each of which has a different reporting folder with its own set of permissions assigned to it.

I suspect the problems are connected. IOW, if it's really true that reports can only reference other reports in one folder, then if you could deploy the way I want to it would break the subreport references...

>L<

|||

Interesting note:

You can specify project interdependance, among subprojects, which implies that one subproject can reference another somehow. (otherwise, why would you need to set one project to be dependant on another)

|||

Of course one project can reference another <s>. That applies when (say) I build a report that references a custom code DLL or -- more commonly in my case -- I build a solution that has some black box code in C# and white box code in VB.

The "somehow" is by instancing classes from other DLLs...

I think what we've been saying in this thread is that, if the same applies to different *report* projects, we don't understand how it works and haven't gotten it to work the way we might have expected it to.

As an example, and one we haven't discussed in this thread yet: suppose I create a second report project in a solution and make it dependent on my first report project. When I want to create a report, can I use a shared data source from the first project? As far as I know... not. FWIW: I have tried referencing the shared datasource in a "solution folder" but that doesn't seem to do the trick.

>L<

|||

Ah, I had wondered what it was for. I have not delved much into custom code for RS yet. I am still primarily a SQL person.

The only solution I have found thus far is to use Source Safe to share my subreports between projects, ala the tool mentioned previously.

To get around the messy listings all these subreports creates, we're building a simple web front end to redirect the users to the correct report.

|||

I have one big project,

within that I have sub projects that publish the reports under them to a different folder on the report server... something like..

Accounts Receivable.

AR Reports

Accounts Payable

AP Reports

etc...

Data Sources has it's own folder.

If I have a AR subreport I want to share with other reports in that folder I simply share them.

If you are going to have a sub report span multiple projects then you need to copy the sub report from one project to the other which in vs2005 is simple as highlighting the sub report, ctrl-c then goin to your other project and press ctrl-v.

you can also have a sub folder in your main folder to hold sub reports.

lots of ways to do it.

|||

You can have one solution and multiple sub projects and have each sub project publish to a different server and/or folder, That seems to work just fine and I think as long as there was no overlap in the reports it would meet your needs.

For reports you want to put in multple locations you'd either need to use the tool you reccomended or copy the report into each project as a later poster reccomends.

I think we're all in agreement that there is no way (or we don't know how) to have a subreport be from a different project than the main report.

Anyway, I guess I'll go back to a single project and make up some clever naming schema so the main reports are at the top of the list and the subreports are at the bottom OR mark the subreports as Hidden. I've not played much with that. I hope I can do that from Visual Studio or if not that when I set it in the Web UI its not overwritten each time I deploy.

Thanks,

-p

|||

Are you letting your users see the reportserver directory as it stands?

You might want to consider doing a little webpage that reads a table that lists where the reports are.

My company has implemented this type of thing.

We have a webpage where the user selects which report group they want and then hit a button and get a list of reports that match...

It is two tables, a group table and a reports table. inthe reports table we have a friendly name for the report and the location to where it is..

works fine for us and the users NEVER see what we don't want them to.

|||

The Original querstion was not answered, but I worked around this by keeping all of the reports in one project and then marking the sub reports as Hidden on the server side.

This setting is preserved even after you re-dpeloy a report. Kind of hard to setup, but bearable.

I wish the original method of using projects with different target folders woudl work though, that would be best.

|||

If I understand your original question correctly, you can use a report from a different project as a subreport.

Let's say that your subreport is "MySubReport.rdl" in project "MyProjectA" and you want to use it from a project in "MyProjectB". Both projects have the same TargetServerURL and the same parent folder (e.g. TargetReportFolder is set to "MySolution/MyProjectA" and "MySolution/MyProjectB").

In Report Designer, drag and drop a subreport item onto your report. Set its subreport property to "./../MyProjectA/MySubReport" and manually set any parameters.

Hope this helps.

Thursday, March 8, 2012

can sql server allow to read record ramdomly?

anyone have the solution or work around?

my system need to select x% ramdom record from a batch of data from sql server for validation. is this posible?

any sql statement allow to select the record ramdomly? let say total record is around 1000, example record that i need to select is:-

record no 5,48,49,50,147,148,256,257,258,411,412,413,414,415,..... so and so

can i use cursor to move around the record to read it?

if we view on performance of the system. how can i make this at max speed? is that clone this table into local access database will make this more faster?

regards

terence chua

How do you intend to use this data ? If you won't display it in tabular form, you could read the entire DataTable, then use random number generation to access different rows in random order ?

|||

actually this is a system to receive customer feedback.

and now i want to basic on the total transaction to take out the % of transaction to collect customer contact information. then i will create a new contact list to allow the system to send out sms to customer to say thanks and request them to reply. just to make sure the customer did feedback to us but not our own staff key in the feedback.

this sms list will also be a report to show to top management. regarding how many sms we send out everyday.

regard

terence chua

|||

You can use TABLESAMPLE (nnn PERCENT) or TABLESAMPLE (nnn ROWS) in your SELECT statement. But be carefully - TABLESAMPLE extracts not exactly nnn percent or nnn rows, i.e. two executions of, for example, 'select * from Person.Contact tablesample (10 percent)' will have thow different rowcounts. See BOL for details.

WBR, Evergray -- Words mean nothing...|||

YOu could use something like this:

SELECT TOP 10 *

FROM

SomeTable

Order by NEWID()

HTH, jens Suessmeyer.

|||

Yes, this kind of query will return exactly specified number of records, but by cost of performance (in common case). Query with 'tablesample' will read random number of table pages (and, yeah, may even return 0 records or double expected count) while query with 'order by newid()' should scan entire table or index and compute newid() for each record to properly sort them and select top(n). The second type of queries may be better (in performance) only with highly selective (or covered) queries with appropriate indexes for support them (and, again, always more accurate :-)). Or, if table has an 'uniqueidentifier' or 'rowguid' column (indexed) - this is may be case, too.

If the main goal is performance of such a query (as I've understand from the first post), and the query is not very selective and not covered by any index, the choice is tablesampling. Inaccuracy of this clause may be eliminated by doing tablesampling twice (or more), for example:

select top 10 percent * from
(select * from sometable
tablesample (10 percent)
where x=y
union
select * from sometable
tablesample (10 percent)
where x=y
) a

will be more accurate with percentage than one sample. Anyway, you should compare performance of queries of both types to select the better one for your needs.

This data may be used to fill out temporary table (directly or by using table variable - the last will be better choice) to process it on server side (sms via Database Mail?). But, if you doing processing in an external application, sure you can (maybe even should) extract data from server in any store which is local for that application so server will be free from take a care of it.

Good luck!

WBR, Evergray
--
Words mean nothing...|||Hi Everygray,
what your mean is using more then 1 time tablesampling to make sure the record more accurate?
to make sure what i understand is correct in ur sample, "a" is temporary table? is the "tablesample(10 percent)" is the syntax for the query?
below is the code for single tablesampling?
--
select * from sometable
tablesample (10 percent)
where x=y
--
so let say my table name call "Answers" then my query should be like this?
select top 30 percent * from
(select * from Answers
tablesample (10 percent)
where date >= yesterday
union
select * from Answers
tablesample (10 percent)
where date >= yesterday
) a
now my system should able to take out the contact information and pass to external system to process and send out the sms. so the output should be in either .txt or .dat file or something else like .xml.
btw are you having any better idea or better way to done the job with sms the data directly out to my customer phone without export the data out? because now my company planing to corporate with a communication provided company to send out sms. so them may request the customer list in a txt, dat or xml file. tat's y i looking for the solution now before my management want it to be implement.
regards
terence chua
|||

Terence Chua wrote:

Hi Everygray,

what your mean is using more then 1 time tablesampling to make sure the record more accurate?

see below...

Terence Chua wrote:


to make sure what i understand is correct in ur sample, "a" is temporary table?

No, it's called 'derived table' (named subquery)

Terence Chua wrote:

is the "tablesample(10 percent)" is the syntax for the query?

below is the code for single tablesampling?
--
select * from sometable
tablesample (10 percent)
where x=y
--


Yes

Terence Chua wrote:

so let say my table name call "Answers" then my query should be like this?

select top 30 percent * from
(select * from Answers
tablesample (10 percent)
where date >= yesterday
union
select * from Answers
tablesample (10 percent)
where date >= yesterday
) a


Ok, maybe I've been not clear enough about sampling. Tablesample reads random number of PAGES, not ROWS. If you specify "tablesample (10 percent)" in your query, server will randomly select approximately 10 percent of pages on which table data is stored (let's say, 10 of 100 total) and return ALL rows from each selected page. If your table is big enough and rows are evenly distributed on data pages, resulting count of rows will be close to 10 percent. But, if, for example, your table is quite small (for example, 5 pages), 10% of total number of pages is zero, so query will result no rows at all. Or, if some of data pages in your table has small count of rows (e.g. 2-3), and some - big (e.g. 20-30), the resulting count will depend on which pages were selected (e.g. your query may return 3 rows or 300 on the same data). Or, if you specify "tablesample (10 rows)" for table which contains 300 rows at all, which are stored on 15 pages, the result again be 0 rows (10 rows from 300 are 3%, and 3% from 15 pages are 0 pages). So, if the same query executed several times against the same data returns very different results (e.g. 0, 30, 300, 100....) we may think about 'equalizing' these results. Your query above should return number of records closer to 6% of total rows than simple 'select * .. tablesample 6%'.


Terence Chua wrote:

now my system should able to take out the contact information and pass to external system to process and send out the sms. so the output should be in either .txt or .dat file or something else like .xml.

btw are you having any better idea or better way to done the job with sms the data directly out to my customer phone without export the data out? because now my company planing to corporate with a communication provided company to send out sms. so them may request the customer list in a txt, dat or xml file. tat's y i looking for the solution now before my management want it to be implement.

regards
terence chua

If number of messages to send is low, you may use sp_send_dbmail stored proc to send them through your smtp server (little emails to xxxxxxx@.mobile.operator.com or so). But this is not likely your case, because it is resource consuming task (all messages are stored in a queue on the server, mailing program executes here too), at least, you should't use the same SQL Server instance for it.

As for export - there are MANY different ways to export data in any format - using linked servers (in any external database or plaintext file), simply executing query with sqlcmd and storing results (maybe using FOR XML) in plaintext file, create webservice which will return such data in desired format to your partner and so on... Again, what the goal is? Which restrictions are? ;-)

WBR, Evergray
--
Words mean nothing...|||

Hi Evergray,

Thanks for your help, but when i try the sql statement in sql server Enterprise Manager, at the view. i get this error.

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'PERCENT'.

below is the code i test on hard code the date at 26th Jan 2006 and get the answer between a range.

SELECT TOP 30 PERCENT *
FROM (SELECT *
FROM Answers tablesample(10 PERCENT)
WHERE (iMinutes BETWEEN 570 AND 1020) AND (MONTH(dtAnswer) = 1) AND (YEAR(dtAnswer) = 2006) AND (iTemplateId = 1) AND (fDiscard = 0)
AND (fIncomplete = 0) AND (DAY(dtAnswer) = 26)
UNION
SELECT *
FROM Answers tablesample(10 PERCENT)
WHERE (iMinutes BETWEEN 570 AND 1020) AND (MONTH(dtAnswer) = 1) AND (YEAR(dtAnswer) = 2006) AND (iTemplateId = 1) AND (fDiscard = 0) AND
(fIncomplete = 0) AND (DAY(dtAnswer) = 26))

|||

The first, you should add an alias for your inner query, such as

select top 30 percent *
from (...) somealias

The second... the error message you refer to... Looks like you are using SQL Server 2000 or your database compatibility level is not 9.0, as required for tablesample to work... If this is the case, you should use Jens's suggestion because tablesampling is unavailable for you.

The third. If your Answers table has an index on dtAnswer column, you'd better use two DateTime constants and BETWEEN clause in you query rather than using these Day(), Year() etc., because your query doesn't benefit from such index, always doing fullscan of table.

WBR, Evergray
--
Words mean nothing....