Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing parameters to stored procedure

Status
Not open for further replies.

tmunson99

MIS
Jun 18, 2004
62
US
Does anyone know if it is possible to pass a formula or Crystal special field to a stored procedure? I'm using BOXI and have a table called Security with UserId along with another information I can use for filtering. I have a stored procedure:

begin

create table #GetDivision (@UserId Varchar(15))

insert into #GetDivision
SELECT Division FROM Security
WHERE [User] = @UserId

select Division from #GetDivision

end

I'd like to join the result (Division) to the source data. The stored procedure runs fine when say I run it from Query Analyzer, however from Crystal it is prompting the user for their User Id to pass into the parameter. It does work when I type in a User Id, but obviously that defeats the whole idea because the user could type in anything. I'd like to pass CurrentCEUserName (or a formula that equals CurrentCEUserName) to this stored procedure.

I know Business Views is an option but we're hoping to implement this without going to Business Views just yet as that is a massive project.

Any other ideas would be appreciated!
 
I should clarify that I'm wanting to use the resultset of the stored procedure to source a dynamic parameter. So a user who has access to Division 1 will only see Division 1 in his parameter choice and a user who has access to Division 1 and 2 will have Division 1 and 2 as a dynamic parameter choices.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top