Hi,
If you want to split the value inside SQL you can use this:
declare @input varchar(max)
declare @delimiter varchar(1)
declare @index int
declare @corrected_input varchar(20)
set @input = 'ABC DEF GHI'
set @delimiter = ' '
set @index = charindex(@Delimiter, @input)
if @index != 0
set @corrected_input = left(@input, @index - 1)
else
set @corrected_input = @input
select @corrected_input
But it looks like there is something funny going on with your VB code. Probably the parameter is being passed wrong.
You could always split it in VB:
Dim inputString As String = "ABC DEF GHI"
' Returns an array containing "ABC", "DEF", and "GHI".
Dim inputArray() As String = Split(inputString)
then use the first value in the array. Does that help?
Regards,
Bevan Keighley