SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Inserting data into another database
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dougancil
Posting Yak Master

USA
217 Posts

Posted - 09/16/2010 :  15:41:36  Show Profile  Send dougancil a Yahoo! Message  Reply with Quote
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

USA
37157 Posts

Posted - 09/16/2010 :  16:03:29  Show Profile  Visit tkizer's Homepage  Reply with Quote
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

USA
217 Posts

Posted - 09/17/2010 :  11:51:44  Show Profile  Send dougancil a Yahoo! Message  Reply with Quote
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

USA
217 Posts

Posted - 10/04/2010 :  10:53:30  Show Profile  Send dougancil a Yahoo! Message  Reply with Quote
I've resolved this issue.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000