I have a ShipmentDetails table that stores the DateIn, DateOut, and AssetId for Assets stored in the asset table.
I've created this query to update the ShipmentDetails DateIn column based on the AssetId and DateOut
SET DateIn = @DateIn
WHERE (AssetId = @AssetId) AND (DateOut = @DateOut)
Asset, DateOut, DateIn
30091,Oct 18 2010 8:50AM, Oct 31 2010 12:00 AM
I need a query to update the DateIn code based on the AssetId and the DateOut. This works fine if I take the @DateOut part, but it updates every row with the asset 30091 and it shouldn't do that, It should only be updating one row since I only have one row with that AssetId AND DateOut.
Soon as I add the @DateOut part back in it doesn't work. It never updates the DateIn WHERE AssetId = '30091' AND DateOut = 'Oct 31 2010 12:00 AM'
I think I got it. There seems to be an extra space between the year and the time that was throwing off my query. Don't know how I missed that! I added that space in there and now its working. Thanks for your reply MCrowley.