Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Check the value of a record.

Posted on 2007-11-20
3
Medium Priority
?
315 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

715 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