You are viewing limited content. For full access, please sign in.

Question

Question

Stored Procedure accessibility

asked on August 28, 2017

In Forms, we have a stored procedure that works great.  When connecting to the same database via workflow, we don't see the stored procedure.  Is that by design or is there an issue with our connection.  

0 0

Answer

SELECTED ANSWER
replied on August 28, 2017

Oh, I totally read this wrong. Query Data does not run procedures. You have to call it yourself in Custom Query with an execute statement:

exec ProcName @Param1=value;

"Alter Procedure" just modifies it, it does not run it.

0 0

Replies

replied on August 28, 2017

Are you using the same SQL user in both Forms and Workflow?

0 0
replied on August 28, 2017 Show version history

Yes, both Worklow and Forms are using the same account for access.  The difference is in Forms, i have the option to choose a stored procedure and in Workflow I am not seeing that.

 

Here is the Forms lookups using that stored procedure (Bottom Image).  I can see that stored procedure in the dropdown for Query Data Activity.  I tried putting the stored procedure in a Custom Query Activity and it always returns -1 row(s) affected.

 

 

Here is the custom query 


ALTER PROCEDURE [dbo].[Ad_Name_Results] 
	-- Add the parameters for the stored procedure here
	@employee nvarchar(30)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
SELECT displayname As Employee, SUBSTRING(manager,4,(CHARINDEX(CHAR(44),manager,1)-4)) As Manager, mail as Email, Department, SUBSTRING(company,1,(CHARINDEX(CHAR(124),company,1)-1)) As EmployeeNumber, userPrincipalName as Username, 'MVIUSA\'+sAMAccountName as UserLogin, SUBSTRING(company,(CHARINDEX(CHAR(124),company,1)+1),(LEN(company)-(CHARINDEX(CHAR(124),company,1)+1))) As PayrollFolder
FROM OpenQuery ( 
	ADSI,  
	'SELECT displayname, mail,  manager, department, company, userPrincipalName, sAMAccountName FROM ''LDAP://WS16-DC1/OU=MVi User Accounts, DC=mviusa,DC=local'' WHERE objectCategory = ''Person'' AND objectClass = ''User'' ')
	WHERE displayname = @employee  ORDER BY displayname
END

 

Capture.JPG
Capture.JPG (77.53 KB)
0 0
SELECTED ANSWER
replied on August 28, 2017

Oh, I totally read this wrong. Query Data does not run procedures. You have to call it yourself in Custom Query with an execute statement:

exec ProcName @Param1=value;

"Alter Procedure" just modifies it, it does not run it.

0 0
replied on August 29, 2017

That worked great.  Thanks!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.