Status: Open
Status: Answered
Status: Closed
Status: Duplicate

Pass FolderID as Paramater to Stored Procedure

0
Posted Nov 10 by John Rusling.

I have been wrestling this one for a couple of days now and thought someone here might be able to help.

I am trying to execute a stored procedure with a single parameter. I am able to pass through a number of variations without trouble but when I try to put through the FolderID or a number as long as the FolderID I get an error.

This is the execute command:

 

SelectSql(new MetastormDefault(),"EXEC SetHours @FolderID", SQLArg("@FolderID", "SOMENUMBER"))

 

 When SOMENUMBER is 5 or 9000005 it works fine but when it is the Folder ID it fails. Any suggestions?

The error I get is just the browser pop-up "An error occurred in this process. Please report the problem to your administrator"

 

2 Answers

0
BEST ANSWER: As chosen by the author.

I have used functions without issue… but havent tried a stored procedure (but would imagine it be similar).

For a function I used:

 

myprocess.variable=SelectSql(new MetastormDefault(),"select  dbo.SubjectCreation('"+ProcessContext.FolderId+"')")


0
BEST ANSWER: As chosen by the author.

Hi John,

 

if your stored procedure is working with values like '5' or '9000005', are you perhaps doing something in the SetHours stored procedure that is truncating the FolderId length?  Maybe you have the stored procedure parameter type set to NVARCHAR(10)?

 

If you are passing the FolderId into a stored procedure the parameter type neds to be at least 31 characters long.

 

Both your methods of calling the stored procedure and Ryan's should be fine i.e. using SQL paramater or dynamic SQL, or you could even use the Stored Procedure activity from the Visual Script toolbox for testing purposes.

 

Lastly, to prove your stored procedure isn't the issue, try just calling the procedure in SQL Server Management Studio with a folder Id and see if behaves as expected.

i.e. EXEC SetHours '0900000000000000000000000646112'

 

Hope that helps.

 

Phil


 You have subscribed and will receive email notifications of updates to this topic. To unsubscribe, uncheck the checkbox.

Statistics

Related categories

Related tags

Your answer

To leave an answer, please sign in.