473,396 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Insert Command

I am using the following command but it doesnt seem to work. Can any one
tell me why:

Insert Into PAT_MAIN (MRN, PAT_LNAME, PAT_FNAME, PAT_MI, PAT_BDATE, PAT_SEX,
FACILITY_ID) Select MRN, PAT_LNAME, PAT_FNAME, PAT_MI, PAT_BDATE, PAT_SEX,
FACILITY_ID From tblimport Where Not Exists (Select * From tblimport where
tblimport.mrn = PAT_MAIN.MRN)

Sorry it is so long.

Mike Charney
Mar 27 '06 #1
2 4166
Mike Charney wrote:
I am using the following command but it doesnt seem to work. Can any one
tell me why:

Insert Into PAT_MAIN (MRN, PAT_LNAME, PAT_FNAME, PAT_MI, PAT_BDATE, PAT_SEX,
FACILITY_ID) Select MRN, PAT_LNAME, PAT_FNAME, PAT_MI, PAT_BDATE, PAT_SEX,
FACILITY_ID From tblimport Where Not Exists (Select * From tblimport where
tblimport.mrn = PAT_MAIN.MRN)

Sorry it is so long.

Mike Charney


Mike, I was looking at your earlier post but there didn't seem to be
enough information in that one. I think what you want for your WHERE
clause is:

WHERE tblimport.mrn NOT IN (SELECT DISTINCT MRN from PAT_MAIN)

That should write into PAT_MAIN any MRNs that are in tblimport but not
already in PAT_MAIN. I think that's what you're after, correct?

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
Mar 27 '06 #2

"Randy Harris" <pl****@send.no.spam> wrote in message
news:KF*******************@newssvr13.news.prodigy. com...
Mike Charney wrote:
I am using the following command but it doesnt seem to work. Can any one
tell me why:

Insert Into PAT_MAIN (MRN, PAT_LNAME, PAT_FNAME, PAT_MI, PAT_BDATE,
PAT_SEX, FACILITY_ID) Select MRN, PAT_LNAME, PAT_FNAME, PAT_MI,
PAT_BDATE, PAT_SEX, FACILITY_ID From tblimport Where Not Exists (Select *
From tblimport where tblimport.mrn = PAT_MAIN.MRN)

Sorry it is so long.

Mike Charney


Mike, I was looking at your earlier post but there didn't seem to be
enough information in that one. I think what you want for your WHERE
clause is:

WHERE tblimport.mrn NOT IN (SELECT DISTINCT MRN from PAT_MAIN)

That should write into PAT_MAIN any MRNs that are in tblimport but not
already in PAT_MAIN. I think that's what you're after, correct?

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.


Hey Randy,

Ya that is what I wanted. Thanks.
Mar 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: 73blazer | last post by:
Hello, I'm looking for a way to make some of my insert templates more readable by placing comments in between the values. I cannot seem to find a way to do this with DB2, is there a way? I'm...
3
by: alexmaster_2004 | last post by:
hi i have made an application using C# that access sql2000. this application is just used to insert data to the database. i use something like this in my code: // string colmnA = TextBox1.Text;...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
1
by: Ed Dror | last post by:
Hi there, I have ASP <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Guestbook.aspx.vb" Inherits="Guestbook" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
7
by: Kevin Lawrence | last post by:
Hi all I want to do "INSERT INTO Table (Blob) Values('blobdataasstring')". ...rather than using the parameter driven method, is it possible? And if so what encoder do I use to convert the...
0
by: Steven Blair | last post by:
Hi, Would be grateful if anyone with a high understanding of the SqlDataSource and FormView could have a look at my example and my problems. This has really been puzzling me for some time, and...
5
by: mabond | last post by:
Hi VB.NET 2005 Express edition Microsoft Access 2000 (SP-3) Having trouble writing an "insert into" command for a Microsoft table I'm accessing through oledb. I've tried to follow the same...
1
by: skanemupp | last post by:
in this program when using the "c"-button it deletes the last token entered. i want to delete the token after the mousecursor. lets say the string is: 12*(81**.5+12) and i put the cursor between...
5
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration:...
7
by: anu b | last post by:
Hi I need to use Clr trigger for insert command My code is as below I am using SQL server 2005 and VS 2008.... but after running this code i didnt get the result as i expexted it shows the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.