Crazy
2012-01-12 12:08:43 UTC
I need to parse a SP, line by line, and changing the output. What I
have now is this SP which I execute (it will search in a view):
declare @Search1 nvarchar(20)
declare @Search2 nvarchar(20)
set @Search1 = 'Ford'
set @Search2 = '3|4'
EXEC SP_MySearch @Model=@Search1, @Motor=@Search2
The above will result in this output:
Model, Motor
Focus, 1.3
Focus, 1.4
Focus, 2.3
Mondeo, 2.3
Mondeo, 3.0
Mondeo, 4.0
What I want to do is _NOT_ to output the above but instead output the
above PLUS additional fields (I have the other info in other
variables):
ID, Type, Model, Motor
1, Car, Focus, 1.3
3, Car, Focus, 2.3
5, Car, Focus, 2.4
6, Car, Mondeo, 2.3
8, Car, Mondeo, 3.0
9, Car, Mondeo, 4.0
I guess I need to do some CURSOR stuff but I can't figure out how to
do this? I have now spent all day trying to find a solution on this
but sadly no luck.
have now is this SP which I execute (it will search in a view):
declare @Search1 nvarchar(20)
declare @Search2 nvarchar(20)
set @Search1 = 'Ford'
set @Search2 = '3|4'
EXEC SP_MySearch @Model=@Search1, @Motor=@Search2
The above will result in this output:
Model, Motor
Focus, 1.3
Focus, 1.4
Focus, 2.3
Mondeo, 2.3
Mondeo, 3.0
Mondeo, 4.0
What I want to do is _NOT_ to output the above but instead output the
above PLUS additional fields (I have the other info in other
variables):
ID, Type, Model, Motor
1, Car, Focus, 1.3
3, Car, Focus, 2.3
5, Car, Focus, 2.4
6, Car, Mondeo, 2.3
8, Car, Mondeo, 3.0
9, Car, Mondeo, 4.0
I guess I need to do some CURSOR stuff but I can't figure out how to
do this? I have now spent all day trying to find a solution on this
but sadly no luck.