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.
Question
Question
Answer
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.
Replies
Are you using the same SQL user in both Forms and Workflow?
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
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.
That worked great. Thanks!