Showing posts with label excel. Show all posts
Showing posts with label excel. Show all posts

Friday, March 30, 2012

Regarding DTS

Hi,

I want to copy the data from Oracle table to excel file in DTS packages.
I have used transformation task, but it is asking for table but excel is a file.
please any body could tell em about this?

Thanks and Regards,
Purushotham,Use connection first.
In connection you will be able to find Excel files or Oracle.

Good Luck.

Monday, March 26, 2012

reg exporting crystal reports to Excel format

Hi Babu,

I have created a report using crystal reports and the template has a field that is formatted with (PrintTime) and another field(File Creation Time). When i export this report to .doc file( using VC++ code) I can see the these fields properly. But when i export to .xls file I get ###### in these fields instead of the actual value. These "######" appear only for the time fields and not for the date fields. Also when the cell is formatted to hold a general value , the cell shows a long number.

Can you help as to what would have caused this problem and how i can rectify this?The "problem" you have is not really a problem, it's how Excel was designed to work.

Excel shows "####" when the column isn't wide enough to show the entire contents.

Excel treats dates as long numbers (probably the number of seconds from a certain date) and it's up to the user to make sure the Cell is formatted to display properly.

As for how to fix it, I'm not sure. You can try Crystal's website to see if you can find an article on formatting Excel Cells and Columns.

http://support.businessobjects.com/search/advsearch.asp|||I have increased the cell size and formatted it for showing time.
The ##### still exists. When i change the cell format to general(a long number) is displayed but in the time format these hashes appear|||You may may not be increasing the width of the column enough. In Excel, assuming that you have the date in cell A1, if you double-click the line that separates the column headers "A" and "B", Excel will automatically resize column "A" to fit the width of the longest Cell in the column. I'm not sure if it will help you in Crystal Reports, but in VB I can achieve this with the following line of code:

xlApp.ActiveSheet.Columns("A:A").EntireColumn.AutoFit|||Try printing Printtime and FileCreationDateTIme in different lines. Maybe it's a data issue. I hope there are no special characters in data. Also try displaying Just YYYY from both fields and slowly slowly try adding mm and dd etc..

THanks

Friday, March 9, 2012

Reference Excel for date?

I have the following query;

SELECT TOP 1 DateTime, TagName, Value, CONVERT(varchar(15), DateTime, 108) AS Time
FROM v_AnalogHistory
WHERE (DateTime1 >= CAST(CONVERT(VARCHAR(8), GETDATE() - 4, 112) AS DATETIME)) AND (DateTime2 < CAST(CONVERT(VARCHAR(8), GETDATE()-3, 112)
AS DATETIME)) AND (TagName = N'AIT-500_TOTAL_NH2CL') AND (wwRetrievalMode = N'delta') AND (CONVERT(decimal(38, 3), Value) IS NOT NULL)
ORDER BY CONVERT(decimal(38, 3), Value), CONVERT(varchar(15), DateTime, 108)

what I would like to do is reference 2 cells in Excel with dates if I need to run this manually. How would I change the sql to do this. Thanks

DateTime1 = cell(1,1)

DateTime2 = cell(2,1)

Something like this:

Code Snippet

declare @.DateTime1 datetime,

@.DateTime2 datetime

select @.DateTime1 = F1 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',

'Excel 8.0;DATABASE=c:\Book1.xls;HDR=NO', 'Select * from [Sheet1$A1:A1]')

select @.DateTime2 = F1 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',

'Excel 8.0;DATABASE=c:\Book1.xls;HDR=NO', 'Select * from [Sheet1$A2:A2]')

SELECT TOP 1 DateTime, TagName, Value, CONVERT(varchar(15), DateTime, 108) AS Time

FROM v_AnalogHistory

WHERE (@.DateTime1 >= CAST(CONVERT(VARCHAR(8), GETDATE() - 4, 112) AS DATETIME))

AND (@.DateTime2 < CAST(CONVERT(VARCHAR(8), GETDATE()-3, 112) AS DATETIME))

AND (TagName = N'AIT-500_TOTAL_NH2CL') AND (wwRetrievalMode = N'delta')

AND (CONVERT(decimal(38, 3), Value) IS NOT NULL)

ORDER BY CONVERT(decimal(38, 3), Value), CONVERT(varchar(15), DateTime, 108)

You'll need to ensure that 'Ad Hoc Remote Queries' is enabled on your instance to allow OPENROWSET to function.

|||

Expanding upon Dale's suggestion, if you want to be able to run the code as it is, or on occasion, manually, then it would be better to create a Stored Procedure and call the Stored Procedure. (NOT tested and not asserted to be accurate or runnable -presented for ideas only.)

This procedure can be called in this fashion:

EXECUTE PROCEDURE dbo.MyProcedure

In this case it will attempt to find date values in the Excel File and use them.

If the cells are empty, then the procedure will use the columns DateTime1 and DateTime2.

(From the original posting, I'm assuming that there are such columns...)

EXECUTE PROCEDURE dbo.MyProcedure '2007/06/01', '2007/07/01'

In this case, the procedure will use the dates supplied.

Code Snippet

CREATE PROCEDURE dbo.MyProcedure

( @.InDate1 datetime = NULL,

@.InDate2 datetime = NULL

)

AS

BEGIN

DECLARE

@.ExDate1 datetime,

@.ExDate2 datetime

SELECT @.ExDate1 = F1 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',

'Excel 8.0;DATABASE=c:\Book1.xls;HDR=NO', 'Select * from [Sheet1$A1:A1]')

SELECT @.ExDate2 = F1 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',

'Excel 8.0;DATABASE=c:\Book1.xls;HDR=NO', 'Select * from [Sheet1$A2:A2]')

SELECT TOP 1

DateTime,

TagName,

[Value],

Time = convert( varchar(15), DateTime, 108 )

FROM v_AnalogHistory

WHERE ( coalesce( InDate1, nullif( ExDate1, '' ), DateTime1 ) >=

cast( convert( varchar(8), getdate() -4, 112) AS datetime )

AND coalesce( InDate2, nullif( ExDate2, '' ), DateTime2 ) <

cast( convert( varchar(8), getdate() -3, 112) AS datetime )

AND TagName = N'AIT-500_TOTAL_NH2CL'

AND wwRetrievalMode = N'delta'

AND convert( decimal(38,3), [Value] ) IS NOT NULL

)

ORDER BY

convert( decimal(38,3), [Value] ),

convert( varchar(15), DateTime, 108 )

END

GO

Monday, February 20, 2012

reduce rendering time in RS2005

We have a reporting system where the default rendering format is HTML.
HOwever, in some cases user may export the data into Excel aftergenerating
the report in HTML. Howveer, this export is taking too much time. eg 5500
row report in HTML takes around 8 minutes to export into excel. Is there a
workaround for this? Please note that default rendering has to be in HTML
only.
Also another feature noticed is that in RS 2005, the report server execution
log seems to be logging seperate entries for export feature as well. This
was not happening in RS2000. Is this a new feature in RS2005 or is the
underlying SP for the new report being called again when the export to excel
happens?
Any help would be appreciatedOn Feb 19, 11:32 pm, SK <S...@.discussions.microsoft.com> wrote:
> We have a reporting system where the default rendering format is HTML.
> HOwever, in some cases user may export the data into Excel aftergenerating
> the report in HTML. Howveer, this export is taking too much time. eg 5500
> row report in HTML takes around 8 minutes to export into excel. Is there a
> workaround for this? Please note that default rendering has to be in HTML
> only.
> Also another feature noticed is that in RS 2005, the report server execution
> log seems to be logging seperate entries for export feature as well. This
> was not happening in RS2000. Is this a new feature in RS2005 or is the
> underlying SP for the new report being called again when the export to excel
> happens?
> Any help would be appreciated
Have you tried exporting to a CSV file?|||This seems excessive amount of time for 5500 rows. I do much more than that
all the time. Of course, complexity matters. Also, any images in the report?
As suggested see how long it takes to export CSV. CSV takes the same amount
of time as HTML.
Also, if you do this you will want to change the CSV to use ASCII instead of
unicode. Excel puts unicode into a single column. To have RS export CSV in
ASCII format you have to make a change to a config file.
You only need to change in one place, rsreportserver.config. Reboot after
the change. The below shows commenting out the existing entry and putting in
the needed change to have CSV export as ASCII
<!--
<Extension Name="CSV"
Type="Microsoft.ReportingServices.Rendering.CsvRenderer.CsvReport,Microsoft.ReportingServices.CsvRendering"/>
-->
<Extension Name="CSV"
Type="Microsoft.ReportingServices.Rendering.CsvRenderer.CsvReport,Microsoft.ReportingServices.CsvRendering">
<Configuration>
<DeviceInfo>
<Encoding>ASCII</Encoding>
</DeviceInfo>
</Configuration>
</Extension>
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"SK" <SK@.discussions.microsoft.com> wrote in message
news:D94C7011-C90D-46F7-AA75-E33CC8BEFF1A@.microsoft.com...
> We have a reporting system where the default rendering format is HTML.
> HOwever, in some cases user may export the data into Excel aftergenerating
> the report in HTML. Howveer, this export is taking too much time. eg
> 5500
> row report in HTML takes around 8 minutes to export into excel. Is there
> a
> workaround for this? Please note that default rendering has to be in HTML
> only.
> Also another feature noticed is that in RS 2005, the report server
> execution
> log seems to be logging seperate entries for export feature as well. This
> was not happening in RS2000. Is this a new feature in RS2005 or is the
> underlying SP for the new report being called again when the export to
> excel
> happens?
> Any help would be appreciated