Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

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

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Advice about a query???
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

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
Eidh ON Temp.PartNO = Eidh.Part_NO

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,


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

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.


Go to Top of Page

Starting Member

24 Posts

Posted - 10/04/2012 :  10:23:10  Show Profile  Reply with Quote
Any ideas guys????

Thx in advance

Go to Top of Page
  Previous Topic Topic Next 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.09 seconds. Powered By: Snitz Forums 2000