Click here to Skip to main content
16,015,097 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
SQL
Create function dbo.fnSplit_Vehicle
(@sInputList varchar(100), @sDelimiter varchar(1))
returns varchar(100)
--select dbo.fnSplit_Vehicle ('1234 abcd', '-')
AS
BEGIN

Declare @Domain varchar(100)

set @Domain = RTRIM(LTRIM(SUBSTRING(@sInputList,1,CHARINDEX(@sDelimiter,@sInputList,0)-1)))

return @Domain

End


i m getting the error

ASM
Msg 537, Level 16, State 2, Line 1
Invalid length parameter passed to the LEFT or SUBSTRING function.



please help
Posted

Hope this[^]might help you to solve your problem.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900