日期:2014-05-17 浏览次数:20592 次
select * from 表 where isnumeric(字段)!=1 or len(ltrim(字段)) !=12
select * from tb where col not like replicate('[0-9]',12)
ALTER FUNCTION [dbo].[FUN_ISNUMERIC](
@STR VARCHAR(8000)
)
RETURNS INT
AS
BEGIN
DECLARE @INDEX INT
SET @INDEX = 1;
WHILE LEN(@STR) >= @INDEX
BEGIN
IF ISNUMERIC(SUBSTRING(@STR,@INDEX,1)) = 0
BEGIN
RETURN 1
END
SET @INDEX = @INDEX + 1
END
RETURN 0;
END
GO
WHERE len(字段) <> 12 OR DBO.FUN_ISNUMERIC(字段) = 1