Showing posts with label urgent. Show all posts
Showing posts with label urgent. Show all posts

Thursday, March 22, 2012

cursor application?

Hi all,
This is not an urgent query merely an interested question. But for
what would I use a Cursor for? I have looked at the on-line help but I
am still unclear why it for what reason it might be employed?
Many thanks
SamTwo reasons would be when you need to do something for each row in a
result set (usually execute a stored procedure), or when you must
process rows in a specific order.

The first case is probably most common in DBA/admin scripts, for
example to write a script which GRANTs execute permission on all stored
procs in a database. I can't think of a good example of the second case
offhand.

You might want to check out this book, which has a chapter on using
cursors:

http://www.sql.co.il/books/advtsql/...rver%202000.htm

But notice the chapter title ("Server-Side Cursors -- the SQL of Last
Resort") - using cursors in application code (as opposed to
DBA/management code) is rather unusual, and generally not at all
desirable.

Simon|||Cursors are a bad idea to use as they hold locks on tables for their
duration. They are also not necessary as you can use set rowcount 1 to
loop through records individually.

Simon Hayes wrote:
> Two reasons would be when you need to do something for each row in a
> result set (usually execute a stored procedure), or when you must
> process rows in a specific order.
> The first case is probably most common in DBA/admin scripts, for
> example to write a script which GRANTs execute permission on all stored
> procs in a database. I can't think of a good example of the second case
> offhand.
> You might want to check out this book, which has a chapter on using
> cursors:
> http://www.sql.co.il/books/advtsql/...rver%202000.htm
> But notice the chapter title ("Server-Side Cursors -- the SQL of Last
> Resort") - using cursors in application code (as opposed to
> DBA/management code) is rather unusual, and generally not at all
> desirable.
> Simon|||Hi
Cursors are mainly used to traverse reach row in the result of a query.

If u would like to check each row and perform a certain operation on
that, u use a cursor. For example u can check for hierarchical queries
in BOL

best Regards,
Chandra
http://groups.msn.com/SQLResource/
http://chanduas.blogspot.com/
------------

*** Sent via Developersdex http://www.developersdex.com ***|||sorry but why not use 'where' or 'if' to check each row?|||Exactly. Chandra's statement is a bit ambiguous. Most of the time you
*can* conditionally perform an operation for each row using a WHERE
clause or using some combination of a WHERE clause and CASE
expressions. Most of the time that is a better option than using a
cursor. The situations where you cannot do it with set-based DML
statements (SELECT, UPDATE, DELETE, INSERT) are usually to do with
iterative operations that cannot feasibly be defined declaratively -
for example the problem of expanding an adjacency list hierarchy to an
unknown depth. In those cases you may find that a cursor or client-side
code are the optimum solutions.

The other sensible application for a cursor is the one Simon mentioned
- administrative and management processes that need to execute non-data
manipulation code for each row in a set - for example performing
backups, loading files, sending emails. For data manipulation
operations, however, 99% of the time there are better solutions that
don't require cursors.

--
David Portas
SQL Server MVP
--|||(chrisandkayenolan@.gmail.com) writes:
> Cursors are a bad idea to use as they hold locks on tables for their
> duration. They are also not necessary as you can use set rowcount 1 to
> loop through records individually.

SET ROWCOUNT 1 is probably the worst form of iteration you can do. That
was what we did back in 4.x days, and it was no fun at all. When you
need to iterate, cursors are indeed the way to do.

Whether cursors hold locks or not, depends on what sort of cursor
you use. The default cursor type is a keyset cursor, a creature I
have never fully understood. Add INSENSITIVE before CURSOR, and you
don't have to worry. The result set for the cursor is fixed once
for all.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.aspsql

Wednesday, March 7, 2012

Cube Processing Error - Urgent - Thanks

First when I processed cube's (Process Data) using SSIS package I got "Memory error"

"Memory error: Allocation failure : Not enough storage is available to process this command."

I changed "OLAP\ Process \ BufferMemoryLimit" to 30% . I have /3GB setup. and I am using AS 2005 - 32 bit.

When I rerun the package I got olap storage engine error

Errors in the OLAP storage engine: An error occurred while processing the 'Scenario Analysis 2006' partition of the 'Scenario Analysis' measure group for the 'Scenario Analysis' cube from the Risk Reports database.

I don't know what's that, so I run cube process (Full) from Management Studio and got error below while reading data process stoped with following popup message

The trace has been stopped
Unexpected end of the file has occurred. The following elements are not closed: root, return, ExecuteResponse, soap:Body soap: Envelope. Line 13180, position 1. (System.Xml)

Thanks for any help - Ashok

Please check if you're running out of disk space...

Cube Processing Error - Urgent - Thanks

First when I processed cube's (Process Data) using SSIS package I got "Memory error"

"Memory error: Allocation failure : Not enough storage is available to process this command."

I changed "OLAP\ Process \ BufferMemoryLimit" to 30% . I have /3GB setup. and I am using AS 2005 - 32 bit.

When I rerun the package I got olap storage engine error

Errors in the OLAP storage engine: An error occurred while processing the 'Scenario Analysis 2006' partition of the 'Scenario Analysis' measure group for the 'Scenario Analysis' cube from the Risk Reports database.

I don't know what's that, so I run cube process (Full) from Management Studio and got error below while reading data process stoped with following popup message

The trace has been stopped
Unexpected end of the file has occurred. The following elements are not closed: root, return, ExecuteResponse, soap:Body soap: Envelope. Line 13180, position 1. (System.Xml)

Thanks for any help - Ashok

Please check if you're running out of disk space...

Cube process problem. Urgent

Hi,

After I changed password for my machine, the cubes process

got system error: “ The following system error occurred:Logon failure: unknown user name or bad

password. “ We have 10 more cubes and still can browse the cubes but no any cube

can processes now.

Before I changed password, everything is working.

We use ‘Windows

Authentication’ for SQL server 2005 Database and Analysis Service.

Anyone can help this problem?

Thanks.

Hello! Check this. Open the cube project in BIDS and change the impersonation mode to default in the data connection.

HTH

Thomas Ivarsson

|||

Hi,

If by any chance that does not work,

set specific credentials for the username and password in the impersonation mode tab.

Also, as a secondary check, see if the user has process permissions.

Regards

Vijay R

|||It sounds like the SSAS service on the server may be set up to use your account. Jump on to the server and check the account credentials using the SQL Server Configuration Manager application. If the service is running under your user account you will either need to update the password or preferrably set up an account for the SSAS service.|||Thank you very much Thomas and Vijay for replaying my email.

I changed the impersonation mode to default then processing works.

Thanks a lot.