SQL中字段拆分存储

时间:2013-02-21 阅读:
UPDATE [jcms_extends_translate3] SET speech= ( SELECT left(a.content1,charindex(':',a.content1)-1) as speech FROM jcms_extends_translate3 a WHERE a.id=jcms_extends_translate3.id ) WHERE [jcms_extends_translate3].content1 LIKE '%:%' GO UPDATE [jcms_extends_translate3] SET content3= ( SELECT right(a.content1,len(a.content1)-charindex(':',a.content1))as content3 FROM jcms_extends_translate3 a WHER

UPDATE [jcms_extends_translate3]
SET speech=
    (
    SELECT
        left(a.content1,charindex(':',a.content1)-1) as speech
    FROM
        jcms_extends_translate3 a
    WHERE a.id=jcms_extends_translate3.id
    )
WHERE
    [jcms_extends_translate3].content1 LIKE '%:%'
GO

UPDATE [jcms_extends_translate3]
SET content3=
    (
    SELECT
        right(a.content1,len(a.content1)-charindex(':',a.content1))as content3
    FROM
        jcms_extends_translate3 a
    WHERE a.id=jcms_extends_translate3.id
    )
WHERE
    [jcms_extends_translate3].content1 LIKE '%:%'
GO

 

[责任编辑:jumbot]

[发表评论] [收藏本页]