Solved

Check the value of a record.

Posted on 2007-11-20
3
308 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:basile
  • 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 500 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now