例:
declare @s nvarchar(4000)
Select @s=isnull(@s+',','')+ typ from S group by typ
print @s
假如@s的值为:S,Y
程序中定义一个字符串类型的变量,怎么能直接将@s的值赋给字符串变量啊???
SqlCommand cmd = new SqlCommand();
SqlParameter parameter = new SqlParameter();
parameter.ParameterName = "@s";
parameter.Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
string s = parameter.Value as string;
1:写成proc,@s output
2: select @s ,co1,col2 from tbl
做为字段
没明白你到底想要什么,能不能说的再明白些