This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > August 2004 > Insert in SQL





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Insert in SQL
Aleks

2004-08-08, 4:14 am

Sorry for bothering so much, thing is I am converting an old database to a
new one and I am not exactly a SQL master, anyways here it is.

OLD TABLE: DELETETHISOLDCOMMENTS
UserId = This is an ID
Comments = text

NEW TABLE: Casecomments
COMID = This is the ID of the table, in this case I think irrelevant
CaseID = This will be equal to the "UserId" in the old table
Comments = This will be equal to the "Comments" in the old table
SectionCase = This must be equal to 'Alien'

So, basically I need to insert the values from table 1 into table 2 (The new
one) using the UserId to insert into CaseId and Comments to insert into
Comments, additionaly for all records field "SectionCase" must be set to
"Alien".

How can this be done ?

Thanks for the help ...

Aleks


Aleks

2004-08-08, 4:14 am

Ok ... this one I figured out:

insert into casecomments (SectionCase,Caseid,Comments,Visible)
select 'Alien',UserId,Comments,'0' from DELETETHISOLDCOMMENTS
"Aleks" <axiaxi2003@hotmail.com> wrote in message
news:cf48ov$6th$1@forums.macromedia.com...
> Sorry for bothering so much, thing is I am converting an old database to a
> new one and I am not exactly a SQL master, anyways here it is.
>
> OLD TABLE: DELETETHISOLDCOMMENTS
> UserId = This is an ID
> Comments = text
>
> NEW TABLE: Casecomments
> COMID = This is the ID of the table, in this case I think irrelevant
> CaseID = This will be equal to the "UserId" in the old table
> Comments = This will be equal to the "Comments" in the old table
> SectionCase = This must be equal to 'Alien'
>
> So, basically I need to insert the values from table 1 into table 2 (The

new
> one) using the UserId to insert into CaseId and Comments to insert into
> Comments, additionaly for all records field "SectionCase" must be set to
> "Alien".
>
> How can this be done ?
>
> Thanks for the help ...
>
> Aleks
>
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews