Help with select statement.

  • Hi,

    I am a newbie learning SQL Server and need your guidance on this.

    I have a table column named YYY that has data something like xysa.discB.txt.

    I want to query the table but only bring the result that shows anything before the first dot(.)

    I tried doing substring but can't get results as I have to specify the query with length.

    Any guidance is much appreciated.

  • declare @t table (test varchar(20));

    insert into @t values ('abc.def'),('three.four'),('12345.67');

    select LEFT(test,charindex('.', test)-1)

    from @t

  • Hi,

    Thank you that worked.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply