I am trying to insert some data into a SQL server that uses a uniqueidentifier for the invId field. My SQL statement doesn't include that field so I assumed that the field would just increment automaticaly as it does in Access. However I get an error that I can not insert Nulls into my InvId field. I did find something on the net about IDENTITY_INSERT but I can't seem to get it to work.
Here is my SQL:
Oops I meant to post this in the database forum. It is a VB related question but I think it should have probably been posted there instead of here.Code:INSERT INTO Reports.dbo.tblMeInventory( invId IDENTITY, CategoryCode, ItemCode, UnitCode, ItemCount, UserName, DateStamp ) SELECT StoreItems.CategoryCode, StoreItems.ItemCode, StoreItems.UnitCode, 0 AS ItemCount, '' AS UserName, '' AS DateStamp FROM lubeShop.dbo.StoreItems WHERE( ((StoreItems.StoreID)<>999) AND ((StoreItems.IsDeleted)=0)) ORDER BY StoreItems.StoreID, StoreItems.CategoryCode, StoreItems.ItemCode




Reply With Quote