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 2005 Forums
 Transact-SQL (2005)
 Advice about a query???

Author  Topic 

Raoulh79
Starting Member

24 Posts

Posted - 2012-10-04 : 06:24:23
Dear All,

I am running the following query in my program:

SELECT Temp.CompanyID, Temp.PartNO, Temp.ProductNO, Temp.Barcode, Temp.Details, Temp.Category, Temp.InsertDate, Temp.Image, Temp.Active
FROM Temp LEFT OUTER JOIN
Eidh ON Temp.PartNO = Eidh.Part_NO
WHERE (Eidh.Part_NO IS NULL)

I have the following case and your help will be appreciated:

The following query returns new items that does not exist in table "Eidh", so the ProductNo has NULL value. But since the ProductNo is part of the primary key when i run the update query it returns error. Is there a way that i can add the specific field value in the update query that i run ???
Example. The last found Product No is 25850, so begin from the first row of the result set add + 1 in each ProductNo field 25851, 25852, 25853...

can be included all this in the above query ????


Thanks in advance,

Best regards,

RH


sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-04 : 06:54:20
Are you trying to update Temp table with new product id's, or are you trying to insert new product id's into the Eidh table? Can you post the update query that you have now?
Go to Top of Page

Raoulh79
Starting Member

24 Posts

Posted - 2012-10-04 : 07:38:17
First of all thanks for your reply.
I am trying to insert new products that are found on Temp table to "Eidh" table.
I have inserted this specific select query in a DataGrid in VIsual basic 2008. when i press a check box the information that is in present raw is inserted as new item on the table "Eidh", it a function of the grid table, I dont run an update query.

The problem is that i have to change the select query in a way that it includes that ProductNo with it's correct value inserted as i described above.

Thanks


RH
Go to Top of Page

Raoulh79
Starting Member

24 Posts

Posted - 2012-10-04 : 10:23:10
Any ideas guys????

Thx in advance

RH
Go to Top of Page
   

- Advertisement -