2014-04-28 2 views
0

SQL Server에서 지정된 수의 행을 선택할 수있는 방법이 있습니까? 여기 내가 같은 특정 행 항목 데이터sql에서 특정 행 번호를 선택 하시겠습니까?

select LEFT(intValue,patindex('%$*%' , intValue) -1) as ID, 
    Right(intValue, (LEN(intValue) - (patindex('%$*%' , intValue) + 1)))as Data 
    from dbo.Split('1$*hi,2$*hellow, ',') ID=1 

을 선택하는 결과가 여기

select LEFT(intValue,patindex('%$*%' , intValue) -1) as ID, 
    Right(intValue, (LEN(intValue) - (patindex('%$*%' , intValue) + 1)))as Data 
    from dbo.Split('1$*hi,2$*hellow, ',') 

ID | Data 
---------------- 
1 | HI 
2 | hellow 

II처럼 보이는 쿼리를 WAN이 어디 ID = 내가

같은 결과가 필요 하나

Data 
----- 
HI 

미리 감사드립니다.

답변

1

select Right(intValue, (LEN(intValue) - (patindex('%$*%' , intValue) + 1)))as Data
from dbo.Split('1$*hi,2$*hellow,3$*Acronym', ',') where LEFT(intValue,patindex('%$*%' , intValue) -1) = 1

+0

덕분에 재생 MayOkaba 것이 나 감사를 위해 일하고 –

1
With CTE As (
select LEFT(intValue,patindex('%$*%' , intValue) -1) as ID, 
    Right(intValue, (LEN(intValue) - (patindex('%$*%' , intValue) + 1)))as Data 
    from dbo.Split('1$*hi,2$*hellow, ',') 
) 
Select * From CTE Where ID = 1