Reputation: 5156
I need to assign the output of split to the variable, how can do this, i tried this
DECLARE @StartMonth nvarchar(5) = select top 1 Value from dbo.split('jun - may', '-')
Step 1:
select top 1 Value from dbo.split('jun - may', '-')
Output is jun
Step 2:
I need to assign it to the variable @StartMonth
Upvotes: 0
Views: 1606
Reputation: 11
Do the following
Declare @StartMonth nvarchar(5)
select top 1 @StartMonth = Value from dbo.split('jun - may', '-')
Upvotes: 0
Reputation: 3681
Try this
DECLARE @StartMonth nvarchar(5)
select top 1 @StartMonth = Value from dbo.split('jun - may', '-')
Upvotes: 1
Reputation: 6374
Please try the following:
DECLARE @StartMonth nvarchar(5)
select top 1 @StartMonth = Value from dbo.split('jun - may', '-')
Upvotes: 1