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
 General SQL Server Forums
 New to SQL Server Programming
 Insert, Update, Delete

Author  Topic 

l-jeff@excite.com
Starting Member

39 Posts

Posted - 2008-07-01 : 12:04:30
I have an insert statement that is working. However, I need to change it so it will only insert a certain value. How do I keep what I have and add additional select to insert PUUP = 'scac'


Insert Into tbl_Config_CarrierCodes ( CODE, CARRIER )
Select ltrim(PUPNUM), rtrim(PUPNAME1) + rtrim(PUPNAME2)
FROM tbl_Buffer_CarriersPalletsContainers
WHERE NOT EXISTS (Select CODE, CARRIER
FROM tbl_Config_CarrierCodes
WHERE tbl_Buffer_CarriersPalletsContainers.PUPNUM = tbl_Config_CarrierCodes.CODE )

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-01 : 12:35:14
may be this;-
Insert Into tbl_Config_CarrierCodes ( CODE, CARRIER )
Select ltrim(PUPNUM), rtrim(PUPNAME1) + rtrim(PUPNAME2)
FROM tbl_Buffer_CarriersPalletsContainers
WHERE NOT EXISTS (Select CODE, CARRIER
FROM tbl_Config_CarrierCodes
WHERE tbl_Buffer_CarriersPalletsContainers.PUPNUM = tbl_Config_CarrierCodes.CODE )
AND PUUP = 'scac'


but i'm not sure this is what you want as i couldnt get much idea from your explanation. You would sound more clearer when you illustrate what you want with some table data.
Go to Top of Page

l-jeff@excite.com
Starting Member

39 Posts

Posted - 2008-07-01 : 12:39:41
PERFECT!!! Thank you so much. I just didn't know where to add the statement. Thanks again!

Lisa Jefferson
Go to Top of Page
   

- Advertisement -