Showing posts with label requests. Show all posts
Showing posts with label requests. Show all posts

Sunday, March 25, 2012

Cursor in SQL Server

Hi,
I've discovered the stored procedures lately, and moving almost all my requests to use this.

I've a question about declaring a cursor.

For example :
DECLARE @.strSQL varchar(255)
SELECT @.strSQL = 'SELECT au_lname FROM authors'

I want to declare the cursor like this
DECLARE csrAuthor
FOR @.strSQL
READ ONLY

I'm always getting an error. Is there a solution to make a "dynamic" cursor.

Thanks
FrankTry putting your DECLARE CURSOR statement inside an execute statement. Like this:

EXEC ('DECLARE Oprid_Cursor CURSOR FOR ' + @.VAR1)

Then you can OPEN the cursor etc.

Hope this helps.|||It might be possible to do something like this also but I haven't tried it:

DECLARE csrAuthor
FOR exec sp_executesql @.strSQL
READ ONLYsql

Saturday, February 25, 2012

cube has been updated by the server, data is now obsolete

Client issues query which sends out individual requests to the 2 OLAP servers that are load balanced. The client evaluates the versions of the returned record sets to ensure the consist data being returned for one single query. Otherwise, this error will be seen:

The cube has been updated by the server the data is now obsolete.

These servers sit behind a cisco 11506 CSS with load balancing based on balance type: least busy server, also persistence based on cookies.

My developer says this worked fine for a long time then just 'started happening'.

any suggestions are appreciated.Any infomational messsage or error on SQL error log?|||I'll see if there are any other associated messages or logs and post them.