Hi,
I'm using two cursors in the same proc.
Do I need to reset @.@.FETCH_STATUS before using it to check the status of the
second cursor? If so, how can this be done.
Many thanks for your answers in advance
Ant
You're using nested cursors? I am fairly confident you can avoid that...
help us help you by showing us your code and explaining why two cursors are
needed.
"Ant" <Ant@.discussions.microsoft.com> wrote in message
news:1B8B4F75-06D5-4DE6-A614-55AB5DA602AC@.microsoft.com...
> Hi,
> I'm using two cursors in the same proc.
> Do I need to reset @.@.FETCH_STATUS before using it to check the status of
> the
> second cursor? If so, how can this be done.
> Many thanks for your answers in advance
> Ant
|||You're on the right track. They weren't nested however, they were in line,
but...
Actually, I just readjusted the code so that I put everything in the first
cursor & now have no need for the second.
Sorry to waste your time but thanks very much for your answer none the less
Ant
"Aaron Bertrand [SQL Server MVP]" wrote:
> You're using nested cursors? I am fairly confident you can avoid that...
> help us help you by showing us your code and explaining why two cursors are
> needed.
>
>
> "Ant" <Ant@.discussions.microsoft.com> wrote in message
> news:1B8B4F75-06D5-4DE6-A614-55AB5DA602AC@.microsoft.com...
>
sql
Showing posts with label cursor. Show all posts
Showing posts with label cursor. Show all posts
Monday, March 26, 2012
resetting @@FETCH_STATUS
Hi,
I'm using two cursors in the same proc.
Do I need to reset @.@.FETCH_STATUS before using it to check the status of the
second cursor? If so, how can this be done.
Many thanks for your answers in advance
AntYou're using nested cursors? I am fairly confident you can avoid that...
help us help you by showing us your code and explaining why two cursors are
needed.
"Ant" <Ant@.discussions.microsoft.com> wrote in message
news:1B8B4F75-06D5-4DE6-A614-55AB5DA602AC@.microsoft.com...
> Hi,
> I'm using two cursors in the same proc.
> Do I need to reset @.@.FETCH_STATUS before using it to check the status of
> the
> second cursor? If so, how can this be done.
> Many thanks for your answers in advance
> Ant|||You're on the right track. They weren't nested however, they were in line,
but...
Actually, I just readjusted the code so that I put everything in the first
cursor & now have no need for the second.
Sorry to waste your time but thanks very much for your answer none the less
Ant
"Aaron Bertrand [SQL Server MVP]" wrote:
> You're using nested cursors? I am fairly confident you can avoid that...
> help us help you by showing us your code and explaining why two cursors are
> needed.
>
>
> "Ant" <Ant@.discussions.microsoft.com> wrote in message
> news:1B8B4F75-06D5-4DE6-A614-55AB5DA602AC@.microsoft.com...
> > Hi,
> > I'm using two cursors in the same proc.
> > Do I need to reset @.@.FETCH_STATUS before using it to check the status of
> > the
> > second cursor? If so, how can this be done.
> >
> > Many thanks for your answers in advance
> >
> > Ant
>
I'm using two cursors in the same proc.
Do I need to reset @.@.FETCH_STATUS before using it to check the status of the
second cursor? If so, how can this be done.
Many thanks for your answers in advance
AntYou're using nested cursors? I am fairly confident you can avoid that...
help us help you by showing us your code and explaining why two cursors are
needed.
"Ant" <Ant@.discussions.microsoft.com> wrote in message
news:1B8B4F75-06D5-4DE6-A614-55AB5DA602AC@.microsoft.com...
> Hi,
> I'm using two cursors in the same proc.
> Do I need to reset @.@.FETCH_STATUS before using it to check the status of
> the
> second cursor? If so, how can this be done.
> Many thanks for your answers in advance
> Ant|||You're on the right track. They weren't nested however, they were in line,
but...
Actually, I just readjusted the code so that I put everything in the first
cursor & now have no need for the second.
Sorry to waste your time but thanks very much for your answer none the less
Ant
"Aaron Bertrand [SQL Server MVP]" wrote:
> You're using nested cursors? I am fairly confident you can avoid that...
> help us help you by showing us your code and explaining why two cursors are
> needed.
>
>
> "Ant" <Ant@.discussions.microsoft.com> wrote in message
> news:1B8B4F75-06D5-4DE6-A614-55AB5DA602AC@.microsoft.com...
> > Hi,
> > I'm using two cursors in the same proc.
> > Do I need to reset @.@.FETCH_STATUS before using it to check the status of
> > the
> > second cursor? If so, how can this be done.
> >
> > Many thanks for your answers in advance
> >
> > Ant
>
Friday, March 23, 2012
Reset Page count, use distinctcount() for page number, or SPROC cursor to reset page numbe
I have a report that will come back as 20 pages.
What the user wants is on the beginning of another unique ID, which causes a new page to be started, to have the page count restart to 1.
So, if I have 3 UniqueIDs for all 20 pages, and the first, IDAA, is 10 pages long, the second, IDBB, is 4 pages long, and the third, IDCC, is 6 pages long, then the page numbering would be as:
1-10 for IDAA
1-4 for IDBB
1-6 for IDCC
I've been told to set a cursor in a SP that determines what page I'm on and then passses this to the result set as a column. This is then set in a group to control page breaks. How could I do this? I'm not very familiar with SPROC cursors.
I know how to do this scenario in Crystal Reports, but am trying to figure it out here with either a page count formula, or some type of distinct count().
Thanks!
What the user wants is on the beginning of another unique ID, which causes a new page to be started, to have the page count restart to 1.
So, if I have 3 UniqueIDs for all 20 pages, and the first, IDAA, is 10 pages long, the second, IDBB, is 4 pages long, and the third, IDCC, is 6 pages long, then the page numbering would be as:
1-10 for IDAA
1-4 for IDBB
1-6 for IDCC
I've been told to set a cursor in a SP that determines what page I'm on and then passses this to the result set as a column. This is then set in a group to control page breaks. How could I do this? I'm not very familiar with SPROC cursors.
I know how to do this scenario in Crystal Reports, but am trying to figure it out here with either a page count formula, or some type of distinct count().
Thanks!
This is what I've tried so far, but it resets on every page.
So, each page is 1 even if the Unique ID spans 2-3 pages.
I only need it to reset on a new field grouping of the list object.
Here's the VB code for the report:
Shared offset As Integer
Public Function GetPN(reset As Boolean, pagenumber As Integer) As Integer
If reset
offset = pagenumber - 1
End If
Return pagenumber - offset
End Function
***************************
In the header, I have a textbox named "tag"
In the footer, I've got the following expression:
="Unique ID Page: " & Code.GetPN(Not(ReportItems!tag.Value Is Nothing),Globals!PageNumber)
Blank
|||My fault...I had the textbox "tag" in the page header and not in the list object itself.
It works!
Thanks!
Subscribe to:
Posts (Atom)