|
Where did eqname come from?
From another table?
If it is obtained from the table teqname
select faultbit, faultname, eqname
into mytable
from (select eqname from teqname) a,
(select 0 as faultbit, overload as faultname union
select 1, deviation from union
select 2, '' union
select 3, '' union
select 4, '' union
select 5, '' union
select 6, '' union
select 7, '') b
-If obtained from other places, or if there is a certain pattern
Then
create table mytable
(
faultbit int,
faultname varchar (10),
eqname varchar (10)
)
declare @eqname
set @eqname = 'value'-assignment
while (condition)
begin
insert inot mytable (faultbit, faultname, eqname)
select faultbit, faultname, @eqname as eqname
from
(select 0 as faultbit, overload as faultname union
select 1, deviation from union
select 2, '' union
select 3, '' union
select 4, '' union
select 5, '' union
select 6, '' union
select 7, '') b
-Here is a statement to assign a new value to @eqname
end |
|