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