0

一列中的项目 name

Tritton AX 180: Universal Gaming Headset (PS3/Xbox 360/PC/Mac)
Rome: Total War - White Label (PC DVD)
Railworks3 - Train Simulator 2012 (PC)

我想得到:

Tritton AX 180: Universal Gaming Headset
Rome: Total War - White Label
Railworks3 - Train Simulator 2012

我调查过replace()

4

1 回答 1

1
DECLARE @s VARCHAR(100) = 
       'Tritton AX 180: Universal Gaming Headset (PS3/Xbox 360/PC/Mac)'

SELECT SUBSTRING(@s, 0, CHARINDEX('(',@s))

name因此,如果您的列名是

SELECT SUBSTRING(name, 0, CHARINDEX('(',name) )
于 2012-11-14T18:02:01.503 回答