Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Check the value of a record.

Posted on 2007-11-20
3
Medium Priority
?
316 Views
Last Modified: 2010-03-20
HI. Without writing a cursor, i would like to check the value in a table, and if the zip = 0 then i dont' want to do the following: however, if it does exist, then i want to go thru this process. thee problem with a cursor, if these tables are over a million rows, it will take to long.

the table i want to check first is qa_mrsi_data and the column is zip

update qa_address
set        qa_address1 = b.addr,
      qa_address_city = b.city,
      qa_address_state = b.state,
      qa_address_zip =b.zip
from qa_mrsi_data b
inner join qa_address on
qa_address.qa_name_sid = b.sid
where [q3.0] > 0 or [q3.1]>0
0
Comment
Question by:Auerelio Vasquez
  • 2
3 Comments
 
LVL 18

Expert Comment

by:Yveau
ID: 20322491
... all you need to do is adding a line saying something similar to:
    and b.zip != 0

I think ...

Hope this helps ...
0
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 20337057
Is zip in the same table or a different table?

If in the same table:

update qa_address
set        qa_address1 = b.addr,
      qa_address_city = b.city,
      qa_address_state = b.state,
      qa_address_zip =b.zip
from qa_mrsi_data b
inner join qa_address on
qa_address.qa_name_sid = b.sid
where [q3.0] > 0 or [q3.1]>0
and zip <> 0



If its in a different table, you juse join to it. Is there a column in both tables that can be used to match?
0
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 1500 total points
ID: 20337058
pdate qa_address
set        qa_address1 = b.addr,
      qa_address_city = b.city,
      qa_address_state = b.state,
      qa_address_zip =b.zip
from qa_mrsi_data b
inner join qa_address on
qa_address.qa_name_sid = b.sid
where [q3.0] > 0 or [q3.1]>0
and b.zip <> 0
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Integration Management Part 2
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question