-3

我需要帮助。我是 SQL 新手,我需要将行字分成两部分。这与代码 SQL 服务器

(2 rows value and work)
VALUE    WORK
0        TODAY_17_05_2013   CONTROL MACHINE
1        TODAY_17_06_2013   CONTROL SOFTWRE       
2        TODAY_17_07_2013   CONTROL HARDAWRE

并获得3张桌子。和
之间有3个空格TODAY_17_05_2013CONTROL MACHINE

(1 TABLE)
VALUE
0
1                    
2   

(2 TABLE)
WORD
TODAY_17_05_2013
TODAY_17_06_2013
TODAY_17_07_2013  

(3 table)-->> create table with description
Description
CONTROL MACHINE
CONTROL HARDAWRE
CONTROL SOFTWRE
4

1 回答 1

0

您可以使用以下查询来执行此操作:

select value
into tValue
from t;

select left(work, charindex('   ', work) - 1) as word
into tWord
from t;

select substring(work, charindex('   ', work) + 3, len(work)) as description
into tDescription
from t;

为什么要将它们放入三个单独的表中,而不是一个包含三列的表?这是某种家庭作业吗?

于 2013-06-12T18:18:59.700 回答