hi all,
thanks for everyone for your support!
i have a report being built in studio 2005. It calls a stored procedure. The
SP runs a query and gets a data set which then loops through to get other
data. At the end the stored procedure cursor returns several data sets.
my problem is that the report services appears to be reading only the data
returned from the first loop of the cursor inside the stored procedure. It
does not return the other result. Can anyone explain how i can retrieve the
other data sets the store procured cursor should be sending out? I have
tested the SP and makde sure it DOES return more than one result.
here is the sp in case you need to see it.:
CREATE PROCEDURE spRetrieveDoorC ardDataForAllLa bs AS
begin
declare @LOCATION_ID int
declare @Building varchar(100), @Room varchar(20), @Department varchar(100)
declare @Primaryempno bigint, @PrimaryContact varchar(50)
declare @PrimaryOfficeP hone varchar(20), @PrimaryHomePho ne varchar(20)
declare @Secondaryempno bigint, @SecondaryConta ct varchar(50)
declare @SecondaryOffic ePhone varchar(20), @SecondaryHomeP hone varchar(20)
declare @BuildingAlias varchar(20)
declare get_loc_id cursor for
SELECT TOP 10 LOCATION.LOCATI ON_ID
FROM
LOCATION INNER JOIN LOCATION_LOCATI ONUSAGE ON LOCATION.LOCATI ON_ID =
LOCATION_LOCATI ONUSAGE.LOCATIO N_ID
INNER JOIN LOCATION_USAGE ON LOCATION_LOCATI ONUSAGE.LOCATIO N_USAGE_ID =
LOCATION_USAGE. LOCATION_USAGE_ ID
WHERE
(LOCATION_USAGE .GROUP_ID = 1) AND
(LOCATION_LOCAT IONUSAGE.LOCATI ON_USAGE_ID = 131)
order by LOCATION.LOCATI ON_ID
open get_loc_id
fetch next from get_loc_id into @LOCATION_ID
while @@fetch_status = 0
begin
--BEGIN CURSOR LOOP
--*************** *************** *************** *************** *************** ************
SELECT @Building = PARENT, @Room = LOCATION_NAME, @Department = DNAME,
@BuildingAlias = UNR_ALIAS_ID
FROM viewLocationsFo rDoorCardReport
WHERE (LOCATION_ID = @LOCATION_ID)
-- This section lookups up the Building Name, Room and Department
SELECT @Building = PARENT, @Room = LOCATION_NAME, @Department = DNAME
FROM viewContacts
WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 4 OR
CONTACT_TYPE_ID = 7 OR
CONTACT_TYPE_ID = 2)
-- This section looks up the Primary Emergency contact name and Office
phone Number
SELECT @PrimaryContact = Contact_First + ' ' + Contact_Last,
@PrimaryOfficeP hone = PHONE_NUMBER, @Primaryempno = empno
FROM viewContacts
WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 8) AND
(PHONE_TYPE_DES CRIPTION = 'office')
-- This section looks up the "Home" phone number for the primary emergency
contact
SELECT @PrimaryHomePho ne = PHONE_NUMBER
FROM viewContacts
WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 8) AND
(EMPNO = @Primaryempno) AND (PHONE_TYPE_DES CRIPTION = 'home')
-- This section looks up the Secondary Emergency contact name and Office
phone Number
SELECT @SecondaryConta ct = Contact_First + ' ' + Contact_Last,
@SecondaryOffic ePhone = PHONE_NUMBER, @Secondaryempno = empno
FROM viewContacts
WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 9) AND
(PHONE_TYPE_DES CRIPTION = 'office')
-- This section looks up the "Home" phone number for the Secondary
emergency contact
SELECT @SecondaryHomeP hone = PHONE_NUMBER
FROM viewContacts
WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 9) AND
(EMPNO = @Secondaryempno ) AND (PHONE_TYPE_DES CRIPTION = 'home')
select @Building as Building, @Room as Room, @Department as Dept,
@LOCATION_ID AS LOCATION_ID, @BuildingAlias as UNRAliasID,
@PrimaryContact as PrimaryContact, @PrimaryOfficeP hone as
PrimaryOfficePh one, @PrimaryHomePho ne as PrimaryHomePhon e,
@SecondaryConta ct as AlternateContac t, @SecondaryOffic ePhone as
SecondaryOffice Phone, @SecondaryHomeP hone as SecondaryHomePh one
--*************** *************** *************** *************** *************** ************
--END CURSOR LOOP
fetch next from get_loc_id into @LOCATION_ID
end
close get_loc_id
deallocate get_loc_id
end
GO 2 2620
Select all of the records in the cursor loop (argh!*) into a temp location,
like a table variable or, if you must, a pound temp table (temporary temp
table, not global, which is pound pound): #tempTable. Then select all the
records with a single select after the cursor.
reporting services is probably getting all of the data, but it sees each of
the results as a separate table and only handles table one. This is, BTW,
extremely normal.
* I would choose something other than a cursor to do this, like building the
denormalized data in temp tables or table variables
--
Gregory A. Beamer
*************** *************** *************** ****
Think Outside the Box!
*************** *************** *************** ****
"andres" <an****@discuss ions.microsoft. com> wrote in message
news:A2******** *************** ***********@mic rosoft.com... hi all, thanks for everyone for your support!
i have a report being built in studio 2005. It calls a stored procedure. The SP runs a query and gets a data set which then loops through to get other data. At the end the stored procedure cursor returns several data sets.
my problem is that the report services appears to be reading only the data returned from the first loop of the cursor inside the stored procedure. It does not return the other result. Can anyone explain how i can retrieve the other data sets the store procured cursor should be sending out? I have tested the SP and makde sure it DOES return more than one result.
here is the sp in case you need to see it.:
CREATE PROCEDURE spRetrieveDoorC ardDataForAllLa bs AS begin declare @LOCATION_ID int declare @Building varchar(100), @Room varchar(20), @Department varchar(100) declare @Primaryempno bigint, @PrimaryContact varchar(50) declare @PrimaryOfficeP hone varchar(20), @PrimaryHomePho ne varchar(20) declare @Secondaryempno bigint, @SecondaryConta ct varchar(50) declare @SecondaryOffic ePhone varchar(20), @SecondaryHomeP hone varchar(20) declare @BuildingAlias varchar(20)
declare get_loc_id cursor for SELECT TOP 10 LOCATION.LOCATI ON_ID FROM LOCATION INNER JOIN LOCATION_LOCATI ONUSAGE ON LOCATION.LOCATI ON_ID = LOCATION_LOCATI ONUSAGE.LOCATIO N_ID INNER JOIN LOCATION_USAGE ON LOCATION_LOCATI ONUSAGE.LOCATIO N_USAGE_ID = LOCATION_USAGE. LOCATION_USAGE_ ID WHERE (LOCATION_USAGE .GROUP_ID = 1) AND (LOCATION_LOCAT IONUSAGE.LOCATI ON_USAGE_ID = 131) order by LOCATION.LOCATI ON_ID
open get_loc_id fetch next from get_loc_id into @LOCATION_ID
while @@fetch_status = 0 begin --BEGIN CURSOR LOOP --*************** *************** *************** *************** *************** ************ SELECT @Building = PARENT, @Room = LOCATION_NAME, @Department = DNAME, @BuildingAlias = UNR_ALIAS_ID FROM viewLocationsFo rDoorCardReport WHERE (LOCATION_ID = @LOCATION_ID)
-- This section lookups up the Building Name, Room and Department SELECT @Building = PARENT, @Room = LOCATION_NAME, @Department = DNAME FROM viewContacts WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 4 OR CONTACT_TYPE_ID = 7 OR CONTACT_TYPE_ID = 2)
-- This section looks up the Primary Emergency contact name and Office phone Number SELECT @PrimaryContact = Contact_First + ' ' + Contact_Last, @PrimaryOfficeP hone = PHONE_NUMBER, @Primaryempno = empno FROM viewContacts WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 8) AND (PHONE_TYPE_DES CRIPTION = 'office')
-- This section looks up the "Home" phone number for the primary emergency contact SELECT @PrimaryHomePho ne = PHONE_NUMBER FROM viewContacts WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 8) AND (EMPNO = @Primaryempno) AND (PHONE_TYPE_DES CRIPTION = 'home')
-- This section looks up the Secondary Emergency contact name and Office phone Number SELECT @SecondaryConta ct = Contact_First + ' ' + Contact_Last, @SecondaryOffic ePhone = PHONE_NUMBER, @Secondaryempno = empno FROM viewContacts WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 9) AND (PHONE_TYPE_DES CRIPTION = 'office')
-- This section looks up the "Home" phone number for the Secondary emergency contact SELECT @SecondaryHomeP hone = PHONE_NUMBER FROM viewContacts WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 9) AND (EMPNO = @Secondaryempno ) AND (PHONE_TYPE_DES CRIPTION = 'home')
select @Building as Building, @Room as Room, @Department as Dept, @LOCATION_ID AS LOCATION_ID, @BuildingAlias as UNRAliasID, @PrimaryContact as PrimaryContact, @PrimaryOfficeP hone as PrimaryOfficePh one, @PrimaryHomePho ne as PrimaryHomePhon e, @SecondaryConta ct as AlternateContac t, @SecondaryOffic ePhone as SecondaryOffice Phone, @SecondaryHomeP hone as SecondaryHomePh one
--*************** *************** *************** *************** *************** ************ --END CURSOR LOOP fetch next from get_loc_id into @LOCATION_ID end close get_loc_id deallocate get_loc_id
end GO
Thank you Cowboy! Why didn't I think of that!!! I'll give it a try!
"Cowboy (Gregory A. Beamer)" wrote: Select all of the records in the cursor loop (argh!*) into a temp location, like a table variable or, if you must, a pound temp table (temporary temp table, not global, which is pound pound): #tempTable. Then select all the records with a single select after the cursor.
reporting services is probably getting all of the data, but it sees each of the results as a separate table and only handles table one. This is, BTW, extremely normal.
* I would choose something other than a cursor to do this, like building the denormalized data in temp tables or table variables
-- Gregory A. Beamer
*************** *************** *************** **** Think Outside the Box! *************** *************** *************** **** "andres" <an****@discuss ions.microsoft. com> wrote in message news:A2******** *************** ***********@mic rosoft.com... hi all, thanks for everyone for your support!
i have a report being built in studio 2005. It calls a stored procedure. The SP runs a query and gets a data set which then loops through to get other data. At the end the stored procedure cursor returns several data sets.
my problem is that the report services appears to be reading only the data returned from the first loop of the cursor inside the stored procedure. It does not return the other result. Can anyone explain how i can retrieve the other data sets the store procured cursor should be sending out? I have tested the SP and makde sure it DOES return more than one result.
here is the sp in case you need to see it.:
CREATE PROCEDURE spRetrieveDoorC ardDataForAllLa bs AS begin declare @LOCATION_ID int declare @Building varchar(100), @Room varchar(20), @Department varchar(100) declare @Primaryempno bigint, @PrimaryContact varchar(50) declare @PrimaryOfficeP hone varchar(20), @PrimaryHomePho ne varchar(20) declare @Secondaryempno bigint, @SecondaryConta ct varchar(50) declare @SecondaryOffic ePhone varchar(20), @SecondaryHomeP hone varchar(20) declare @BuildingAlias varchar(20)
declare get_loc_id cursor for SELECT TOP 10 LOCATION.LOCATI ON_ID FROM LOCATION INNER JOIN LOCATION_LOCATI ONUSAGE ON LOCATION.LOCATI ON_ID = LOCATION_LOCATI ONUSAGE.LOCATIO N_ID INNER JOIN LOCATION_USAGE ON LOCATION_LOCATI ONUSAGE.LOCATIO N_USAGE_ID = LOCATION_USAGE. LOCATION_USAGE_ ID WHERE (LOCATION_USAGE .GROUP_ID = 1) AND (LOCATION_LOCAT IONUSAGE.LOCATI ON_USAGE_ID = 131) order by LOCATION.LOCATI ON_ID
open get_loc_id fetch next from get_loc_id into @LOCATION_ID
while @@fetch_status = 0 begin --BEGIN CURSOR LOOP --*************** *************** *************** *************** *************** ************ SELECT @Building = PARENT, @Room = LOCATION_NAME, @Department = DNAME, @BuildingAlias = UNR_ALIAS_ID FROM viewLocationsFo rDoorCardReport WHERE (LOCATION_ID = @LOCATION_ID)
-- This section lookups up the Building Name, Room and Department SELECT @Building = PARENT, @Room = LOCATION_NAME, @Department = DNAME FROM viewContacts WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 4 OR CONTACT_TYPE_ID = 7 OR CONTACT_TYPE_ID = 2)
-- This section looks up the Primary Emergency contact name and Office phone Number SELECT @PrimaryContact = Contact_First + ' ' + Contact_Last, @PrimaryOfficeP hone = PHONE_NUMBER, @Primaryempno = empno FROM viewContacts WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 8) AND (PHONE_TYPE_DES CRIPTION = 'office')
-- This section looks up the "Home" phone number for the primary emergency contact SELECT @PrimaryHomePho ne = PHONE_NUMBER FROM viewContacts WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 8) AND (EMPNO = @Primaryempno) AND (PHONE_TYPE_DES CRIPTION = 'home')
-- This section looks up the Secondary Emergency contact name and Office phone Number SELECT @SecondaryConta ct = Contact_First + ' ' + Contact_Last, @SecondaryOffic ePhone = PHONE_NUMBER, @Secondaryempno = empno FROM viewContacts WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 9) AND (PHONE_TYPE_DES CRIPTION = 'office')
-- This section looks up the "Home" phone number for the Secondary emergency contact SELECT @SecondaryHomeP hone = PHONE_NUMBER FROM viewContacts WHERE (LOCATION_ID = @LOCATION_ID) AND (CONTACT_TYPE_I D = 9) AND (EMPNO = @Secondaryempno ) AND (PHONE_TYPE_DES CRIPTION = 'home')
select @Building as Building, @Room as Room, @Department as Dept, @LOCATION_ID AS LOCATION_ID, @BuildingAlias as UNRAliasID, @PrimaryContact as PrimaryContact, @PrimaryOfficeP hone as PrimaryOfficePh one, @PrimaryHomePho ne as PrimaryHomePhon e, @SecondaryConta ct as AlternateContac t, @SecondaryOffic ePhone as SecondaryOffice Phone, @SecondaryHomeP hone as SecondaryHomePh one
--*************** *************** *************** *************** *************** ************ --END CURSOR LOOP fetch next from get_loc_id into @LOCATION_ID end close get_loc_id deallocate get_loc_id
end GO This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Amy B |
last post by:
Hi,
A co-worker is creating a vb.net web application which uses the
CryptKeeper.dll to encrypt credit card numbers into a sql database.
It is my job to pull these encrypted numbers and use the decrypt
method of this dll to show the credit card numbers on a Reporting
Services report. I'm not even sure where this should be done. In the
sql stored procedure or in the report itself? Any help would be
greatly appreciated.
|
by: Paul Say |
last post by:
I have a asp.net application that will need to create a document/report from
data in a database. The user will fill out a form supplying various criteria
for parameters. I would like the document/report to then be displayed on
screen as well as the option to download in PDF format.
I am just wondering which is the best reporting development tool to use
between SQL Reporting Services and Crystal Reports.
The report will have three...
|
by: Brendan Reynolds |
last post by:
I'm trying to integrate SQL Server Reporting Services reports into an
ASP.NET app (SRS 2000, ASP.NET 1.1). I know how to do this using direct URL
addressing, but this exposes in the query string parameters that should not
be exposed. Each user is associated with a school, and should see only that
school's data. When the user logs in, I retrieve the SchoolID associated
with that user, and that SchoolID is used as a parameter in all stored...
|
by: Nesa |
last post by:
I have a stored procedure that wraps a moderately complex query over 5,
6 related tables. The performance of the procedure is unacceptably slow
as it takes on average 5-10 min to complete.
To diagnose the problem, I copied the query in db2 command editor, and
substituted the procedure parameters that appear in the query with
fixed values with intention to locate the parts that are slowing it
down. However when I run the query unmodified it...
|
by: kbutterly |
last post by:
Good afternoon,
I have what appears to be a caching issue, but i'm a bit of a newbie at
http headers so it may be something else.
I have a small asp.net 2.0 application that is called to serve up some
SQL Reporting Services reports. The asp pages are running under SSL as
are the pages that call the asp app.
The asp app runs correctly, but the reports cannot be opened or saved.
| |
by: Brian Tkatch |
last post by:
In case anyone finds this helpful:
Microsoft SQL Reporting Services (SRS) works with DB2, but parameters
for stored PROCEDUREs do not, as It does not pull a list of them from
DB2. The problem, IIRC, is that SRS sends a query to the system
catalog, and quotes the PROCEDURE's name (as it must) but the
PROCEDURE's name is in smallcaps. Which means, unless the PROCEDURE is
CREATEd in quoted-smallcaps, SRS's query will return no parameters....
|
by: steveschoonover |
last post by:
I wrote a SQL Stored procedure on the Iseries (AS400) V5R4 in Iseries Navigator and I am trying to call it from 2005 SQL Reporting Services and I am trying to use the OLE DB managed provider from IBM Client Access V5R4 "IBMDA400 OLE DB Provider" to make the connection inside reporting services. When I test the connection, it is OK, but when I test the call to the Stored procedure when creating the data set, I get an error "Object Reference not...
|
by: jtrapat1 |
last post by:
Im using sql server 2005 and visual studio 2005.
I just want to create some reports and deploy them to the local reportserver for an intranet application by using reporting services.
I'd like to use the report designer to create my reports but it seems kind of confusing with the many ways you can get into the report designer and be offered different options thru the wizards.
Heres what I can do:
I can create a generic report by using this...
|
by: napstar |
last post by:
I have a stored procedure in created in oracle(pl sql).I'd like call that stored procedure in SQL Server Reporting services.How do I accomplish this?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |