2013-02-18 2 views

답변

3

substr을 사용하십시오. 여기 테스트 예 : http://sqlfiddle.com/#!4/9b800/1

create table t (v varchar(50)); 

insert into t values ('this is a test of the substr fn'); 
insert into t values ('this is another test of the substr fn'); 

select 
    substr(v,1,10) restricted_output, 
    v unrestricted_output 
from t 

결과 집합 : 내가 원하는 정확하게이었다

 
RESTRICTED_OUTPUT UNRESTRICTED_OUTPUT 
this is a   this is a test of the substr fn 
this is an   this is another test of the substr fn 
+0

이렇게하면 완벽하게 작동합니다. 감사! – Marco

+0

당신을 가장 환영합니다. – bernie

2

귀하의 질문은 매우 모호합니다. 테이블의 필드가 X 문자 (15, 30, 무엇이든)를 허용하고 길이가 10 인 레코드 만 원한다고 말하고 있습니까? 그렇다면 ... 다음은 테이블 이름과 yourField를 시스템의 값으로 대체하여 작동합니다.

Select * from tableName where length(yourField) = 10 

그러나 모든 테이블 열의 길이가 10이면 끝납니다. 테이블/열 및 필드 크기 목록을 보려면 All_tab_cols 뷰를 확인하십시오.

+0

. Obs : 내 sqldbx 함수에서 len()입니다. 감사! – Marco

관련 문제