Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 set string to result of sp?

Author  Topic 

chedderslam
Posting Yak Master

223 Posts

Posted - 2009-11-04 : 16:35:34
How do I set a local variable to the result of a stored procedure?

chedderslam
Posting Yak Master

223 Posts

Posted - 2009-11-04 : 17:08:48
I have this, but it is returning the string as a result set and setting the variable to '0':
if (len(isnull(@rule_regex, '')) = 0)
begin

declare @get_rules_input varchar(max)

select @get_rules_input = '<Root><Company>'
+ cast(pp.company as varchar(1))
+ '</Company><State>'
+ cast(pp.policy_state as varchar(2))
+ '</State><Program>'
+ cast(pp.program as varchar(1))
+ '</Program><Rate_Table>'
+ cast(pp.rate_table as varchar(10))
+ '</Rate_Table><Rule_Groups><Rule_Group_Id>6</Rule_Group_Id></Rule_Groups></Root>'
from pos_policy pp
where pos_id = @pos_id

exec @rule_regex = kait_get_rules @get_rules_input

end
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-11-04 : 17:56:38
need an OUTPUT parameter in the SPROC? make sure OUTPUT parameter is same datatype as @rule_regex . do you have an OUTPUT parm in your sproc?

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -