Showing posts with label built. Show all posts
Showing posts with label built. Show all posts

Friday, March 30, 2012

HELP!!! Printer Delivery Extension not Printing Landscape

Hello All,

I'm using SQL Server 2005 Reporting Services, and I'm trying to have subscriptions print. To try this, I built, installed, and configured the printer delivery extension sample provided by Microsoft.

Everything appeared to be working fine. That is, I can schedule a report to print automatically using the printer delivery extension. However, the problem is that the reports always print portrait.

We have a number of reports--some are portrait and some are landscape. So, obviously, I need the landscape reports to print lanscape.

I've even tried "hard-coding" the page width and page height parameters in the printer delivery extension to try to force it to print landscape, but it still always prints portrait.

Would any one know how to have reports that are delivered to a printer actually print in the way they are created (i.e., print landscape if the report is set up as a landscape report)?

Do I have to use the IMAGE format? Could I use PDF? If so, how?

Thanks!

Hi,

there is a likewise issue if you use linked reports in RS - the linked report does not contain the original page settings.

It probably could be that you would have to set the page settings programmatically like described by Brian Welcker for the linked reports:
http://www.fits-consulting.de/blog/PermaLink,guid,e3f1cf4a-f9d6-44d8-86e5-84a59531f87c.aspx

hth...

cheers,
Markus

|||

Thanks for the info. Markus. Unfortunately, setting the page settings programmatically didn't help. All reports and linked reports always print portrait, not landscape.

Therefore, would any one have any ideas on how to use the printer delivery extension and make scheduled reports be delivered automatically to a printer and acutally print in landscape?

Please see me original post and let me know if more info. is needed to answer my questions.

Thanks!

Wednesday, March 28, 2012

Help! T-SQL, Calling multiple stored procs?

I have to load a webpage table up with values from a database as such:

The Webpage Expects a Final result set of rows with 5 columns each built as below:

For each Row Returned by StoredProc1

Write Columns 1-3 = StoredProc2

Write Column 4 = StoredProc3

Write Column 5 = StoredProc4

Next Row


But I am not sure how to write the conditionals to CALL the stored procs i wrote and loop by a return value from StoredProc1.

Any help is much appreciated!

THANKS!

I would prefer to create separate stored proc with entire logic encapsulated within it, if I were you. Loops are fast and typical in client languages, but in SQL it's better not to be overused.|||So create just one big stored proc to do it all?
|||Yes. And calling stored procs from within stored procs is not so fast.|||

Can you be a little more specific about what each stored proc does? I mean, if it is a set of procs you are writing, then I doubt this is the best way to do it. I would be more inclined to write one stored procedure with one SELECT statement that joins 3 larger sets together (perhaps in temp tables) on the common value from a fourth set.

select *

from QueryFromSP1

outer join (QueryFromSP2) as QueryFromSP2
on QueryFromSP1.key = QueryFromSP2.key

...

The queries could be temp tables, or function calls, depending on the need, but a cursor like you have suggested will probably be a dog in performance (and not one of those really fast dogs either. Think hound dog on a hot Mississippi morning dogs.)

Friday, March 23, 2012

help! question about hardware request for SQL Server and Analysis Services

I built a database with a huge table which has 18 billion lines for 6(or 7) columns.

And in the Analysis Services the table is used to create a dimention and a measure.

One of the other two dimentions is made form a 4000 line table,and the other is

made from a 3 million line table(time dimension table).

The specification of my Server is Windows Server 2003 with Xeon Intel Cpu 5160 @.3.00GHz,

2.99GHz,4.00G RAM.

The problem comes out when i start the processing of Analysis Services.

the "time out" error comes out after 1 hour, however, the performance i need

is completing the Processing for one cube within 10 munites.

I want to know the hardware request to reach my needs and how to speed the

processing of Analysis Services.

Thank you

So, to be clear, you have an 18 billion row fact table, you have built a cube on top of it and you want a full process to complete in 10 minutes?

Chris

|||

Dear Mr

yes! I wanna a full process within 10 minutes.

Can it be done?

thanks in advance

tomigisi

|||

The short answer is no, not if you're using MOLAP storage for your measure group. The best throughput I've ever seen for cube processing with MOLAP storage is around 200000 rows per second, and that was a maximum rather than something that could be consistently achieved throughout the whole process; you should be happy with 60-70000 rows per second if you've got a top-end server and a properly-tuned relational datasource.

I would experiment with using ROLAP or HOLAP storage, or with pre-aggregating your fact table in some way to reduce the overall number of rows.

Sorry,

Chris

|||

We have a monster server: 8 - 3.2GHZ processors, a disk frame that reads/writes 400 MB/sec, 32 GB of ram, etc and we couldn't even process 18 Billion rows that fast. The slowdown is reading rows from the DB, and most likely not the server (unless you have slow disks).

sql

Monday, March 19, 2012

Help! Index corrupting? DBCC CheckTable failing?

We are having quite a time since moving a large database to a new
server (actually built new server, renamed as old to make seamless for
users, etc.)

Import 104 million row database (5 column) into table (CD_Assets_bad2)
from existing (CD_Assets):
Account(varchar(8))
TransactionDate(datetime(8)
Flow(varchar(1))
Category(varchar(7))
TotalValue(decimal(8))

Run DBCC CheckTable - no issues.
Create 4 non clustered indexes (3 single column, 1 two-column). All
indexes create fine.

Run DBCC CheckTable again and receive the following:
Server: Msg 8951, Level 16, State 1, Line 1

Table error: Table 'CD_Assets_bad2' (ID 244195920). Missing or invalid
key in index 'idx_totalvalue' (ID 7) for the row:

Server: Msg 8955, Level 16, State 1, Line 1

Data row (1:11154499:98) identified by (RID = (1:11154499:98) ) has
index values (TotalValue = -10).

Server: Msg 8952, Level 16, State 1, Line 1

Table error: Database 'CD', index 'CD_Assets_bad2.idx_totalvalue' (ID
244195920) (index ID 7). Extra or invalid key for the keys:

Server: Msg 8956, Level 16, State 1, Line 1

Index row (1:20855652:338) with values (TotalValue = -0

4) points to the data row identified by (RID = (1:11154499:98)).

DBCC results for 'CD_Assets_bad2'.

There are 104397173 rows in 677904 pages for object 'CD_Assets_bad2'.

CHECKTABLE found 0 allocation errors and 2 consistency errors in table
'CD_Assets_bad2' (object ID 244195920).

repair_fast is the minimum repair level for the errors found by DBCC
CHECKTABLE (CD.dbo.CD_Assets_bad2 ).

Any ideas? It seems like some sort of corruption, but the index
creates fine. If anyone can help please let me know. If I can provide
any addtional information that might help, please let me know.

Thanks,
David
david.schwartz@.schwab.com[posted and mailed, please reply in news]

David Schwartz (david.schwartz@.schwab.com) writes:
> Any ideas? It seems like some sort of corruption, but the index
> creates fine. If anyone can help please let me know. If I can provide
> any addtional information that might help, please let me know.

Both errors 8252 and 8956 have articles in Books Online. (Just search
for the numbers.)

Both articles says that the index must be reparied or dropped.

Since your indexes appears to be corrupted when you build them, it smells
a hardware problem to me. I would probably open a case with Microsoft
to investigate this.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Try Creating clusterd index and import the data after dropping all the
existing indexes in the destination table.

david.schwartz@.schwab.com (David Schwartz) wrote in message news:<32d60003.0312021706.10bee3d6@.posting.google.com>...
> We are having quite a time since moving a large database to a new
> server (actually built new server, renamed as old to make seamless for
> users, etc.)
> Import 104 million row database (5 column) into table (CD_Assets_bad2)
> from existing (CD_Assets):
> Account(varchar(8))
> TransactionDate(datetime(8)
> Flow(varchar(1))
> Category(varchar(7))
> TotalValue(decimal(8))
> Run DBCC CheckTable - no issues.
> Create 4 non clustered indexes (3 single column, 1 two-column). All
> indexes create fine.
> Run DBCC CheckTable again and receive the following:
> Server: Msg 8951, Level 16, State 1, Line 1
> Table error: Table 'CD_Assets_bad2' (ID 244195920). Missing or invalid
> key in index 'idx_totalvalue' (ID 7) for the row:
> Server: Msg 8955, Level 16, State 1, Line 1
> Data row (1:11154499:98) identified by (RID = (1:11154499:98) ) has
> index values (TotalValue = -10).
> Server: Msg 8952, Level 16, State 1, Line 1
> Table error: Database 'CD', index 'CD_Assets_bad2.idx_totalvalue' (ID
> 244195920) (index ID 7). Extra or invalid key for the keys:
> Server: Msg 8956, Level 16, State 1, Line 1
> Index row (1:20855652:338) with values (TotalValue = -0
> 4) points to the data row identified by (RID = (1:11154499:98)).
> DBCC results for 'CD_Assets_bad2'.
> There are 104397173 rows in 677904 pages for object 'CD_Assets_bad2'.
> CHECKTABLE found 0 allocation errors and 2 consistency errors in table
> 'CD_Assets_bad2' (object ID 244195920).
> repair_fast is the minimum repair level for the errors found by DBCC
> CHECKTABLE (CD.dbo.CD_Assets_bad2 ).
> Any ideas? It seems like some sort of corruption, but the index
> creates fine. If anyone can help please let me know. If I can provide
> any addtional information that might help, please let me know.
> Thanks,
> David
> david.schwartz@.schwab.com

Help! I need to make a database driven site

I have built databases in Access before (i'm not bad at that) and i
can build websites (not great but OK) but i have never combined the
two thus far. However i now need to make a database driven website for
my client who has a quite large website with many visitors.
I know that they would not be happy about buying MS Sequel, however
the remote web host for their site has a MS sequel licence.
All i want to do be able to do is to design and build the database and
pages myself before it all gets uploaded to the net then i imagine i
would connect all of this up somehow (another story)
Will i need to get a MS sequel licence for my computer, if all i want
to do is design and build a database which will be hosted on a web
host that has the sequel licence, or could i use MSDE or MS Sequel
developers edition to build a database on my computer and then upload
to the web server?
Just to clarify i will be doing this all on my single computer which
isn't network and is just for little old me to design and upload
websites on.
If this is the case, could i use the familiar MS access as my front
end with MSDE or MS Sequel developers edition as the back end?For development and testing purposes you can purchase SQL Server Developer
Edition for $50. Unlike MSDE this includes the client tools such as Query
Analyzer and Enterprise Manager.
http://www.microsoft.com/sql/howtobuy/development.asp
--
David Portas
SQL Server MVP
--|||or look into the new "Sql Server 2005 Express" it is the "NEW" MSDE.
http://lab.msdn.microsoft.com/express/sql/
Cheers,
Greg Jackson
PDX, Oregon|||> If this is the case, could i use the familiar MS access as my front
> end with MSDE or MS Sequel developers edition as the back end?
For web development I'm not sure why you'd need it but yes, you can use
Access as a front-end to SQL Server.
--
David Portas
SQL Server MVP
--

Help! I need to make a database driven site

I have built databases in Access before (i'm not bad at that) and i
can build websites (not great but OK) but i have never combined the
two thus far. However i now need to make a database driven website for
my client who has a quite large website with many visitors.
I know that they would not be happy about buying MS Sequel, however
the remote web host for their site has a MS sequel licence.
All i want to do be able to do is to design and build the database and
pages myself before it all gets uploaded to the net then i imagine i
would connect all of this up somehow (another story)
Will i need to get a MS sequel licence for my computer, if all i want
to do is design and build a database which will be hosted on a web
host that has the sequel licence, or could i use MSDE or MS Sequel
developers edition to build a database on my computer and then upload
to the web server?
Just to clarify i will be doing this all on my single computer which
isn't network and is just for little old me to design and upload
websites on.
If this is the case, could i use the familiar MS access as my front
end with MSDE or MS Sequel developers edition as the back end?
For development and testing purposes you can purchase SQL Server Developer
Edition for $50. Unlike MSDE this includes the client tools such as Query
Analyzer and Enterprise Manager.
http://www.microsoft.com/sql/howtobuy/development.asp
David Portas
SQL Server MVP
|||or look into the new "Sql Server 2005 Express" it is the "NEW" MSDE.
http://lab.msdn.microsoft.com/express/sql/
Cheers,
Greg Jackson
PDX, Oregon
|||> If this is the case, could i use the familiar MS access as my front
> end with MSDE or MS Sequel developers edition as the back end?
For web development I'm not sure why you'd need it but yes, you can use
Access as a front-end to SQL Server.
David Portas
SQL Server MVP

Wednesday, March 7, 2012

HELP! - Cast from DBNull when there is Data

Hi,

I have built a few pages and a stored procedure and a class on the back of a SQL2000 dbase. and I get the following error:

Cast from type 'DBNull' to type 'String' is not valid.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.InvalidCastException: Cast from type 'DBNull' to type 'String' is not valid.

Source Error:

Line 111: Dim myWorkJobs As WorkJobsDATA = New WorkJobsDATALine 112:Line 113: myWorkJobs.CustomerID = CStr(parameterCustomerID.Value)Line 114: myWorkJobs.WorkID = CStr(parameterWorkID.Value)Line 115: myWorkJobs.DateOfQuote = CStr(parameterDateOfQuote.Value).Trim()


Source File:C:\Inetpub\wwwroot\Commerce\Components\WorkJobs.vb Line:113

My Database has 1 line of data (for testing) and all fields are populated. I am Querying a column called IndividualID which has a value of 3425243 at the moment. This is hardcoded in the aspx.vb at the moment.

ASPX VB:

Public Class WorkRequest
Inherits System.Web.UI.Page

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub

Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click

'for now, send this value (stored in dbase under individualID) to the querystring

Dim IndividualID As String = "3425243"

Response.Redirect("WorkRequestMain.aspx?IndividualID=" & IndividualID)
End Sub
End Class

COMPONENTS\WorkJobs.vb (This is the class file)

Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient

Namespace ASPNET.StarterKit.Commerce


Public Class WorkJobsDATA

Public CustomerID As String
Public WorkID As String
Public DateOfQuote As String
Public QuoteAmount As String
Public Title As Decimal
Public FirstName As String
Public Surname As String
Public FirstLine As String
Public District As String
Public Town As String
Public Postcode As String
Public Telephone As String
Public Requirements As String
Public WorkRequired As String
Public EmailAddress As String

End Class

Public Class WorkJobs


Public Function GetWorkDetails(ByVal IndividualID As String) As WorkJobsDATA

Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim myCommand As SqlCommand = New SqlCommand("SP_PendingQuotes", myConnection)

' Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure

' Add Parameters to SPROC
Dim parameterIndividualID As SqlParameter = New SqlParameter("@.IndividualID", SqlDbType.NVarChar, 50)
parameterIndividualID.Value = IndividualID
myCommand.Parameters.Add(parameterIndividualID)

Dim parameterCustomerID As SqlParameter = New SqlParameter("@.CustomerID", SqlDbType.BigInt, 8)
parameterCustomerID.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterCustomerID)

Dim parameterWorkID As SqlParameter = New SqlParameter("@.WorkID", SqlDbType.NVarChar, 50)
parameterWorkID.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterWorkID)

Dim parameterDateOfQuote As SqlParameter = New SqlParameter("@.DateOfQuote", SqlDbType.DateTime, 8)
parameterDateOfQuote.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterDateOfQuote)

Dim parameterQuoteAmount As SqlParameter = New SqlParameter("@.QuoteAmount", SqlDbType.Money, 8)
parameterQuoteAmount.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterQuoteAmount)

Dim parameterTitle As SqlParameter = New SqlParameter("@.Title", SqlDbType.NVarChar, 50)
parameterTitle.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterTitle)

Dim parameterFirstName As SqlParameter = New SqlParameter("@.FirstName", SqlDbType.NVarChar, 50)
parameterFirstName.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterFirstName)

Dim parameterSurname As SqlParameter = New SqlParameter("@.Surname", SqlDbType.NVarChar, 50)
parameterSurname.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterSurname)

Dim parameterFirstLine As SqlParameter = New SqlParameter("@.FirstLine ", SqlDbType.NVarChar, 50)
parameterFirstLine.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterFirstLine)

Dim parameterDistrict As SqlParameter = New SqlParameter("@.District", SqlDbType.NVarChar, 50)
parameterDistrict.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterDistrict)

Dim parameterTown As SqlParameter = New SqlParameter("@.Town", SqlDbType.NVarChar, 50)
parameterTown.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterTown)

Dim parameterPostcode As SqlParameter = New SqlParameter("@.Postcode", SqlDbType.NVarChar, 50)
parameterPostcode.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterPostcode)

Dim parameterTelephone As SqlParameter = New SqlParameter("@.Telephone", SqlDbType.NVarChar, 50)
parameterTelephone.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterTelephone)

Dim parameterRequirements As SqlParameter = New SqlParameter("@.Requirements", SqlDbType.NVarChar, 3500)
parameterRequirements.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterRequirements)

Dim parameterWorkRequired As SqlParameter = New SqlParameter("@.WorkRequired", SqlDbType.NVarChar, 3500)
parameterWorkRequired.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterWorkRequired)

Dim parameterEmailAddress As SqlParameter = New SqlParameter("@.EmailAddress", SqlDbType.NVarChar, 100)
parameterEmailAddress.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterEmailAddress)

myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()

parameterEmailAddress.Value.GetType()

Dim myWorkJobs As WorkJobsDATA = New WorkJobsDATA

myWorkJobs.CustomerID = CStr(parameterCustomerID.Value)
myWorkJobs.WorkID = CStr(parameterWorkID.Value)
myWorkJobs.DateOfQuote = CStr(parameterDateOfQuote.Value).Trim()
myWorkJobs.Title = CStr(parameterTitle.Value).Trim()
myWorkJobs.FirstName = CStr(parameterFirstName.Value).Trim()
myWorkJobs.Surname = CStr(parameterSurname.Value).Trim()
myWorkJobs.FirstLine = CStr(parameterFirstLine.Value).Trim()
myWorkJobs.District = CStr(parameterDistrict.Value).Trim()
myWorkJobs.Town = CStr(parameterTown.Value).Trim()
myWorkJobs.Postcode = CStr(parameterPostcode.Value).Trim()
myWorkJobs.Telephone = CStr(parameterTelephone.Value).Trim()
myWorkJobs.Requirements = CStr(parameterRequirements.Value).Trim()
myWorkJobs.WorkRequired = CStr(parameterWorkRequired.Value).Trim()
myWorkJobs.EmailAddress = CStr(parameterEmailAddress.Value).Trim()


Return myWorkJobs

End Function


End Class
End Namespace

And finally my stored procedure:


CREATE Procedure SP_PendingQuotes
(
@.IndividualID nvarchar,
@.CustomerID bigint OUTPUT,
@.WorkID nvarchar(50) OUTPUT,
@.DateOfQuote datetime OUTPUT,
@.QuoteAmount money OUTPUT,
@.Title nvarchar(50) OUTPUT,
@.FirstName nvarchar(50) OUTPUT,
@.Surname nvarchar(50) OUTPUT,
@.FirstLine nvarchar(50) OUTPUT,
@.District nvarchar(50) OUTPUT,
@.Town nvarchar(50) OUTPUT,
@.Postcode nvarchar(50) OUTPUT,
@.Telephone nvarchar(50) OUTPUT,
@.Requirements nvarchar(3500) OUTPUT,
@.WorkRequired nvarchar(3500) OUTPUT,
@.EmailAddress nvarchar(100) OUTPUT
)
AS

SELECT
@.IndividualID = IndividualID,
@.CustomerID = CustomerID,
@.WorkID = WorkID,
@.DateOfQuote = DateOfQuote,
@.QuoteAmount = QuoteAmount,
@.Title = Title,
@.FirstName = FirstName,
@.Surname = Surname,
@.FirstLine = FirstLine,
@.District = District,
@.Town = Town,
@.Postcode = Postcode,
@.Telephone = Telephone,
@.Requirements = Requirements,
@.WorkRequired = WorkRequired,
@.EmailAddress = EmailAddress

FROM
PendingQuotes

WHERE
IndividualID = @.IndividualID
GO


Any ideas anyone?

I appreciate this is a big amount of data, but if anyone wants to chat to me i'm available on MSN Messenger underwolvokid@.msn.com

The problem is in the stored procedure, you've defined @.IndividualID as nvarchar, specify the length, as it is defaulting to 1. Your query then returns no values because there is no record where IndividualID='3'|||

Call me muppett! It all becomes a blur after you go over and over everything a million times trying to find out whats wrong.

Thanks very much. It works now!