Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Passing Named Parameters to SQL Server Stored Procedures.
Topic Summary:
Created On: 11/25/2014 07:19 PM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Leonard Amabile, on Thursday, April 9, 2015 3:17 PM

Answer:
Phillip,

Have you attempted to use your string in the SQL Query action? It would be the same way you would write it in SQL management Studio or how you have referenced it in your original post.

 11/25/2014 07:19 PM
User is offline View Users Profile Print this message

Author Icon
PhillipWilkie
Apprentice (20-49)

Posts: 29
Joined: 10/09/2014

How can I pass named parameters to a SQL Server Stored Procedure.

eg if I have a stpred proc that has optional paramaters I need to pass the name otherwise it gets confused.

This Proc may have input Parameters

Declare @P1 varchar(10) = '', @P2  varchar(10)= '',  @P3  varchar(10)= ''

in SQL I would write

 



 Category Survey
AutoMate 7 version: 7.1.2
Windows version: Windows 2003



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)
 11/26/2014 01:57 PM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Phillip,

There is a parameters section in the Stored Procedure action that allows you to pass the parameters as you describe.



 Category Survey
AutoMate 7 version:
Windows version:


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 11/26/2014 05:55 PM
User is offline View Users Profile Print this message

Author Icon
PhillipWilkie
Apprentice (20-49)

Posts: 29
Joined: 10/09/2014

That's kinda vague.  Anymore detail?  I have checked all of th tabs in the stored proc window and nothing jumps out. 



 Category Survey
AutoMate 7 version: 7.1.2
Windows version: Windows 2003
 11/26/2014 11:01 PM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Phillip,

Please see the attached screenshots. The Parameters section is in the bottom left. You will need to click on the add button to add each parameter. I have also attached sample code showing a stored procedure with parameters.

 Category Survey
AutoMate 7 version:
Windows version:



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


Click for full image
Click for larger image



-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 11/28/2014 04:19 PM
User is offline View Users Profile Print this message

Author Icon
PhillipWilkie
Apprentice (20-49)

Posts: 29
Joined: 10/09/2014

The parameters section allows you to add parameters but does not use there names.  The output from the example provided would be 

Declare @P1 int output

exec myProc 'boo',  @P1 output

The names pprovided are ignored.  I have to provide the required parameters in the correct order becuase of this.



 Category Survey
AutoMate 7 version: 7.1.2
Windows version: Windows 2003
 12/03/2014 12:42 PM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Answer Answer
Phillip,

Have you attempted to use your string in the SQL Query action? It would be the same way you would write it in SQL management Studio or how you have referenced it in your original post.



 Category Survey
AutoMate 7 version:
Windows version:


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1482 guests browsing this forum, which makes a total of 1482 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog