SSIS Report Format Issue - sql-server

I want to generate a csv report with the following format in SSIS -
Some Static Text - 1
Data from SQL
Some Static Text - 2
Data From SQL
I was thinking to create a report with these static texts in my report and generate the SQL data at runtime. But i can not fix the position of the Some Static text - 2 as the records from SQL can be 'n' in numbers.
I am newbie to SSIS, any help is much appreciated

You need SSRS. You can build reports for it in Visual Studio. SSIS is an ETL tool (Extract, transform, load) which is primarily used to aggregate data, migrate data, consolidate data, etc. SSRS is a tool that allows end-users to consume dynamic reports that you provide.
EDIT:
Install SSRS and configure it so that it's working:
https://msdn.microsoft.com/en-us/library/ms143711.aspx
I assume you already have SSDT since you mentioned SSIS, but just in case you don't:
https://msdn.microsoft.com/en-us/hh500335(v=vs.103).aspx
Then you'll open Visual Studio, create a new SSRS project, make a new report, define your datasource(s), and use the toolbox to add tables or whatever other display you need. It can also use parameters if you need user-input. Static content can be placed wherever you need it - and different datasets can be displayed wherever you need them, as well.
I would like to help more, but it sounds like you are starting from scratch and I can't possibly tell you everything there is to know about SSRS in this forum. So, here is an SSRS Tutorial:
https://msdn.microsoft.com/en-us/library/ms167305.aspx
Good luck - SSRS/SSIS/SSDT are awesome tools so I'm sure you'll find what you need.

Related

How to access the data base behind IBM Cognos Report Studio

We are using the IBM Cognos Report Studio for Making the Reports.
And we have 1000s of reports developed and using.
Now i need to fetch all the SQL queries written in these 1000+ reports.
For that at present i am opening the report studio for each individual report and getting the query.
But it is very tedious job and taking months to get all the SQLs in these 1000+ reports.
So i am looking for a way to get all these queries from database behind Cognos studio.
Does these report parameters (including the SQL) store in a Database or only in Contentstore?
If it store in DB then is it possible to access the Report Studio in a Database tool like Oracle SQL Developer?
So that i can fetch all the SQLs in one shot from the database table.
Thanks for the help!
My experience migrating from one reporting product to another is like what you are asking. I think I had 7000 reports that I was aware of plus many reports sitting on workstation hard drives. At some point along the way we realized that the new product had different features than the old one, so report redesign was a good option in most cases. It took 18 months once we actually started working on the reports. That was to replace the 700 "standard" reports. Users were on their own (with support from IT and subject matter experts) for their custom work. I now have about 19,000 reports in Cognos.
Except where the report developer wrote SQL in a SQL object in the Queries area, Cognos reports do not contain SQL code. Cognos generates the SQL at runtime based on the report spec and user interaction (what parameters they set, what page the opened, etc.). Short of writing your own report spec parser, duplicating the work that Cognos does for you, there is no way I know of to generate the SQL.
One possibility: I haven't dug too deeply into the Cognos SDK. There may be a method there to generate the SQL for each report. Then you can do it automatically. Be aware that for thousands of reports you'll want to run this process during non-work hours. It could run for hours and may use a lot of resources.
Another possibility: Turn on native query logging (Cognos Administration | System | All dispatchers | | Set properties | Settings | Logging | Check the boxes for "Audit the native query..."). Then have a person, a product like those from Motio, or a Cognos SDK program you create yourself run every report. Then you can get the SQL from the Audit database. Of course, the problem here is answering prompts. It will probably take a person to run these.
To add two columns to a list, or two data elements to a report or page header or footer, or two filters (I don't know what you mean by "clause"), you'll want to use the Cognos SDK.
Choose relevant examples of different types of reports.
Examine the XML report spec for each of those reports.
Determine how to identify where the new element should appear in the XML.
Write a program (probably in C# or Java) to use the SDK to...
inspect every report in your environment.
determine which pattern the report fits.
add the data elements.
save the report.

Can I automatically export data from a Cognos report into a database?

The overall goal is to have data from an automated daily Cognos report stored in a database so that I am able to report not only on that day but also historical data if I so choose. My general thought is that if I can find a way to automatically add the new daily data to an existing Excel file, I can then use that as my data source and create a dashboard in Tableau. However, I don't have any programming experience, so I'm floundering here.
I'm committed to using Tableau, but I chose Excel only because I'm more familiar with that program than others, along with the fact that an Excel output file is an option in Cognos. If you have better ideas, please don't hesitate to suggest them along with why you believe it's a better idea.
Update: I'm still jumping through hoops to try to get read-only access to the backend database to make this process a lot more efficient, but in the meantime I've moved forward with the long method utilizing Cognos.
I was able to leverage a coworker to create a system file folder to automatically save the Cognos reports to, and then I scheduled a job to run the reports I need. Each of those now saves into a folder in a shared network drive (so my entire team has access to the files), and I wrote a series of macros to append the data each day from those feeder files in the shared drive to a Master File. Now all that's left is to create a Tableau dashboard using the Master File as the data source and I'll have what I need.
Thanks for all your help!
I'm posting this an an answer because, it's just too much to leave as a comment.
What you need are 3 things.
Figure out how to have COGNOS run your report and download your Excel file.
Use Visual Studio with BIDS (which is the suite of SQL analysis, reporting, and integration services) to automate all the stuff you need to do to append your Excel files, etc... Then you can use the same tools to import that data to your SQL server.
In fact, if all you're doing is trying to get this data into SQL, you can skip the Append Excel part, and just append the data directly to your SQL table.
Once your package is built, you can save it as an automated job on your SQL server to run whenever you wish.
Tableau can use your SQL server as a data source. Once you have that updated, you can run your reports.

How do I set remove the database name from the query in Crystal Reports?

We are a development firm integrating Crystal Reports 2013 into our software. I need the ability to remove the database name from the SQL Query generated by Crystal Reports. We have customers running multiple instances of our software using the same data server. So we need to remove the database name so when it connects it uses the database specified in our file.dsn for an ODBC connection. We are using SQL Server as our data source. Any help would greatly be appreciated.
It depends on how you're using Crystal (this answer may or may not apply to your scenario). If you're using the .Net objects (in VB or C#) and programming against them you can switch out your connection information programmatically. It is finicky about the order in which you do it (e.g. you need to change the connection in the report and all sub reports, etc.).
I have two blog posts that have VB and C# with them that address changing database/connection dynamically through code, they are a few years old but they should still apply:
http://www.blakepell.com/2012-05-22-crystal-reports-extension-methods
http://www.blakepell.com/2010-09-17-crystal-reports-changing-the-database-connection-from-net-subreport-links-and-the-case-of-the-missing-parameter-values
On a side note, if you don't like the SQL that Crystal Reports generates you can always use a "Command" where you input your own SQL and then Crystal treats it kind of like a table (or you can take the SQL it generates to get your started and alter it to your liking, copy it, change it, then create a command with it).
Crystal reports uses that query for generating the schema for the report which you can change the connection or change the query inside the code of software but the schema should be the same,
perhaps you are not setting the connection of report by code successfully, you have to set the parameters and change the connection inside the code which loads the report if you do this successfully then you'll see the report.

SQL server 2008 - Charting problems

I'm trying to create a chart from the below table and ideally would like a line chart with weeks across the bottom, one static sales target line ( Average would work ) and then 4 curve lines for the people. Note: The country and year do not need to be displayed.
Easy to do with a pivot chart in excel, but I am really confused on this one and very new to SQL. Any advise/help would be appreciated.
http://i.stack.imgur.com/PjuSt.jpg
SQL itself cannot make charts, it can only provide data which other tools can use to make charts from. Using Excel is one solution; other depend on what DBMS you are using and what tools you have available. For example, if you are using SQL Server, then SQL Server Reporting Services (SSRS) makes this easy (once you've set it up).
But with just SQL - no, no charts.

Programmatically export SQL Server views to Excel

I posed this question about 8 months ago, and the fact that we were running SQL Server 2000 seemed to be the limiting factor. We recently upgraded to SQL Server 2008 and I still can't find a solid solution to this problem.
We have an Access application interfacing with a SQL Server database and we need to find a way to programmatically export a given view to an Excel spreadsheet -- or at least an Excel compatible spreadsheet (CSV, tab delimited, etc.) I can use bcp, however several of the views contain fields with linefeeds in them, which proves troublesome when importing to Excel. These views are also varied and have unpredictable columns, so to the best of my knowledge using OPENROWSET is also not an option, as you need to have an Excel template with rows predefined.
Any help here would be appreciated. I know my way around Access and SQL Server, but my knowledge is somewhat limited.
When you say "programatically", which language were you hoping to implement the solution in?
I would suggest SQL Server SSIS as a good starting point. If you needed to code this dynamically, rather than using the BIDS/Visual Studio Designer there is plenty of support for this in the .NET libraries, allowing you to do it in c#/VB
If you want to export data into CSV you may write your own function to escape special characters in fields
(It is a pain in one place)
If you use SSIS to export your data into Excel it will put apostrophe and the beginning of every cell
If you willing to spend some money you may consider using our Advanced ETL processor
First of all it works correctly with Excel all the time.
Plus it has data export component which allows you to select the tables/views to
export using mask
You can use scheduler to automate it or you can run a package from the command line
This on-line tutorial gives you a quick introduction to data export
http://www.dbsoftlab.com/online-tutorials/advanced-etl-processor/advanced-etl-pro-exporting-data-from-mysql-database-into-text-files.html

Resources