Showing posts with label declare. Show all posts
Showing posts with label declare. Show all posts

Wednesday, March 21, 2012

I want to clarify..

Can we declare any variables in the sql server 2000 reporting services?
because I need to make an array for my tables, for ex: in my database(sql
server) it has many tables like tble27,tble28,tble29,tble30.. etc. all of
the fields inside the tables are the same. every table has
name,age,sex,address. just different records. I was planning on making an
array like tble(i) so i can use the report parameter to just use the
variable for an easy access to whatever my client would prefer to view.
Also just telling me how, and where to declare variables would be a great
help, if it is possible.. advance thank you. please do help me
Diff. Question:
Also how will i access a table from database1 as my report parameter and and
view the records from database2?
--
~SiMPLe~Hi,
For your first question you should consider a stored procedure based on a
parameter which returns the proper underlying table. Then you can create a
dataset and use the sp to retrieve the data. Declare in the properties of the
dataset the mapping of the ReportParameter and the parameter nessesary for
the sp.
Every dataset you create in SRS has it's own connection. And those
connection can point to different datasources. So just create two datasources
to your servers and retrieve the information.
Jan Pieter Posthuma
"Alex" wrote:
> Can we declare any variables in the sql server 2000 reporting services?
> because I need to make an array for my tables, for ex: in my database(sql
> server) it has many tables like tble27,tble28,tble29,tble30.. etc. all of
> the fields inside the tables are the same. every table has
> name,age,sex,address. just different records. I was planning on making an
> array like tble(i) so i can use the report parameter to just use the
> variable for an easy access to whatever my client would prefer to view.
> Also just telling me how, and where to declare variables would be a great
> help, if it is possible.. advance thank you. please do help me
> Diff. Question:
> Also how will i access a table from database1 as my report parameter and and
> view the records from database2?
> --
> ~SiMPLe~

Friday, February 24, 2012

I need help with stored procedures.

Basically I've got a stored procedure, and I want to declare a variable within that stored procedure then put a value into that varible with a SELECT statement , then INSERT that value, along with some other values, into another table. I hope im explaining myself right.
Anyway, here's my code (its wrong)

/*
This stored procedure adds a new issue
*/

CREATE PROCEDURE {databaseOwner}{objectQualifier} [PreciseData_IssueTracker_AddIssue]
@.moduleId int,
@.starterUserId int,
@.typeId int,
@.subject varchar (50)
AS

SET @.assignedUserId = SELECT userId FROM PreciseData_IssueTracker_Assignments WHEREtypeId=@.typeId


INSERT INTO PreciseData_IssueTracker_Issue
(
moduleId,
starterUserId,
assignedUserId,
statusId,
typeId,
subject,
startDate
)
VALUES
(
@.moduleId,
@.starterUserId,
@.assignedUserId,
1,
@.typeId,
@.subject,
getdate()
)
GO

Like this:

SELECT @.assignedUserId = userId FROM PreciseData_IssueTracker_Assignments WHEREtypeId=@.typeId


|||Thanks very much!