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 2005 Forums
 Transact-SQL (2005)
 Advice about a query???
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Raoulh79
Starting Member

24 Posts

Posted - 10/04/2012 :  06:24:23  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 10/04/2012 :  06:54:20  Show Profile  Reply with Quote
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 - 10/04/2012 :  07:38:17  Show Profile  Reply with Quote
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 - 10/04/2012 :  10:23:10  Show Profile  Reply with Quote
Any ideas guys????

Thx in advance

RH
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.06 seconds. Powered By: Snitz Forums 2000