Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Insert into one table if not exists in other tab

Author  Topic 

jayram
Starting Member

47 Posts

Posted - 2013-06-25 : 16:09:16
i have two tables

CODES and RATES

CREATE TABLE [dbo].[RATES](
[CBA] [varchar](6) NOT NULL,
[NOS] [varchar](5) NOT NULL)

CREATE TABLE [dbo].[CODES](
[CBA] [varchar](6) NOT NULL)

my rates table has 4 records like follows for CBA01

insert into RATES select 'CBA01', 'A4233'
insert into RATES select 'CBA01', 'A4234'
insert into RATES select 'CBA01', 'A4235'
insert into RATES select 'CBA01', 'A4236'

my codes table has CBA01 to CBA100

my rates table has entries for CBA01. i want to duplicate the records for CBA01 for all other CBA's (CBA02 to CBA100) in rates table.

Any help!!

thanks

jayram
Starting Member

47 Posts

Posted - 2013-06-25 : 16:22:19
Never mind. i got it using Cross join.

Thanks
Go to Top of Page
   

- Advertisement -