declare @test varchar(30) select @test = '12.Project name...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

declare @test varchar(30)
select @test = '12.Project name one'

declare @res int

-- the command that you need is this
select @res = convert(int, substring(@test, 1, charindex('.', @test)-1))


select @res

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results