Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
SELECT SUBSTRING(field,1,CHARINDEX('-',field)-1) FROM yourtable WHERE CHARINDEX('-',field)>0
SELECT CHARINDEX('-',field) as DashPosition, Count(*) as Howoften FROM yourtable GROUP BY CHARINDEX('-',field)
Declare @yourtable as Table (field char(10) null)
insert into @yourtable values ('a-1'),('b4'),(null)
SELECT CHARINDEX('-',field) as DashPosition, Count(*) as Howoften FROM @yourtable GROUP BY CHARINDEX('-',field)
Declare @yourtable as Table (field char(10) null)
insert into @yourtable values ('a-1'),('b-4-v'),(null)
SELECT LEN(field)-LEN(REPLACE(field,'-','')) as NumberOfDashes, Count(*) as Howoften FROM @yourtable GROUP BY LEN(field)-LEN(REPLACE(field,'-',''))
Declare @Temp Table(Data VarChar(20));
Insert Into @Temp Values('abc-123');
Insert Into @Temp Values('xyz-789');
Insert Into @Temp Values('abc');
Insert Into @Temp Values('-123');
Insert Into @Temp Values('-');
Insert Into @Temp Values('');
Insert Into @Temp Values(null);
Select Data As Before,
Left(Data, CharIndex('-', Data + '-')-1) As After.
From @Temp