Solved

Check the value of a record.

Posted on 2007-11-20
3
314 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 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

622 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