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
 General SQL Server Forums
 New to SQL Server Programming
 Showing records updated after running script

Author  Topic 

jl_oh
Starting Member

2 Posts

Posted - 2010-10-18 : 14:07:37
I am somewhat of a noob when it comes to in depth SQL programming. WE have a table that gets updated with the UPDATE command based on the record's ref. number.

our udpate command is like this
UPDATE ITEM SET MISC2 = 000051 WHERE ITEM_REF_NO = '111111'

When we run the update commmand not all records get updated, but it only gives a long list in the output window that a record was or was not updated.

What we need is to run the update on the table and then be able to see what records were not updated. It doesnt have to be anything fancy, but everything I have tried just isnt working.

Any help would be great!!

Thanks jl_oh

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-18 : 14:10:55
I'm confused.

To see what didn't get updated, then you can run this:
select * from ITEM WHERE ITEM_REF_NO <> '111111'

Can ITEM_REF_NO have nulls?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jl_oh
Starting Member

2 Posts

Posted - 2010-10-18 : 15:51:30
Its not updating ITEM_REF_NO, its updating the MISC2 field where the ITEM_REF_NO field meets a certain criteria. All of the ITEM_REF_NO are unique. I just used 111111 as an example.

When we run the prebuilt scripts we need to have a list of the records that did not get updated. We cant use a select statement because all of the records are unique.

Thanks for the help :)

Jake
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-18 : 15:57:34
Please show us a real example then.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -