Q:

need split the left side '/' charcter in sql server

I have a query in SQL 2014
SELECT [orde_reference],
SUBSTRING([orde_reference], 
CHARINDEX('/', [orde_reference]) + 1, 
LEN([orde_reference])) AS batch FROM   Orders 

That returns the following
input is ,86156161566156/454
Result need
86156161566156 only 
Thanks

A:

Perhaps left() would be a cleaner option
Select left([orde_reference],charindex('/',[orde_reference]+'/')-1)

