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
 Transact-SQL (2000)
 Inserting data into another database

Author  Topic 

dougancil
Posting Yak Master

217 Posts

Posted - 2010-09-16 : 15:41:36
I have the following query:


SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

ALTER PROCEDURE YourProcedure AS

insert into msbtotal.dbo.newclients
SELECT tcms_members.dbo.memberdata.* FROM tcms_members.dbo.memberdata left outer join
msbtotal.dbo.memberdata on tcms_members.dbo.memberdata.id =
msbtotal.dbo.memberdata.id where msbtotal.dbo.memberdata.id is
null
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


that is supposed to check for any differences between the memberdata table in TCMS_members and MSBTotal and see if there are null values. I have supplied some sample data to the TCMS_members database to check if this is working and it doesnt appear to be inserting any data into the newclient database at all. It's also not giving me any errors.

How this is supposed to happen is that these two databases compare each other, and then if there is "new" data, that data is then inserted into my "newclient" table. Can anyone offer me an idea as to why they think that this isn't giving me any data?

Thank you

Doug

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-16 : 16:03:29
Please show us some sample data, specifically showing us the join condition and where clause.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

dougancil
Posting Yak Master

217 Posts

Posted - 2010-09-17 : 11:51:44
A sample of a record from database1 is as follows:

6001185 Some Person Some Persons Title Speciality A CLINIC (512) 555-1212 (512) 555-1321 Jun 26 1959 12:00AM 1313 Mockingbird Lane Ste 201 Austin TX 78705-1000 5/11/2010 10:54:14 AM 9/22/1991

If that record is NOT in database2, based on the fact that this record ID (6001185) is NOT null, it should be added to both database2, table Memberdata as well as added to the "newclients" table.

Is this the information that you were asking me for?

Thanks

Doug
Go to Top of Page

dougancil
Posting Yak Master

217 Posts

Posted - 2010-10-04 : 10:53:30
I've resolved this issue.
Go to Top of Page
   

- Advertisement -