I'm trying to set varchar variable like this :
DECLARE @var NVARCHAR(40)
set @var = (SELECT name from Tmptable AS name )
I want this variable store value like this : 'name1,name2,name3,...'
This returns an error like the one in the title: Subquery returned more than 1 value.
I use this variable in paramter of on function
Select *
Into Tmp2
FROM [dbo].[MyFunction](@var, DEFAULT) AS PARAM
.....
I know we can't put more than value in a variable.I need that Variable represent More Than One Value by split value to ","
Any regard in this regards