怎么获取空格以前的数据

如何获取空格以前的数据比如字段是1231323asdasasd那么我想得到结果是123asdas[解决办法]写反了.select le

如何获取空格以前的数据
比如字段是
123     1323
asdas   asd
那么我想得到结果是
123
asdas

[解决办法]
写反了.

select left(字段 , charindex( ' ' , 字段) - 1) from tb

[解决办法]
先要drop掉test表.
ALTER PROCEDURE [dbo].[testProc]
AS
BEGIN
if exists(select 1 from sysobjects where xtype= 'U ' and name= 'test ')
drop table test
declare @test int;
select count(*) as c into test from table2;
print @test

END
[解决办法]
select a,left(a,charindex( ' ',a)) FROM test