Solved

Check the value of a decimal type column

Posted on 2007-11-16
7
174 Views
Last Modified: 2010-04-21
I have a SQL table column X which hold a data type varchar2

I have the table populated with some records.

and the data looks like

21.98
23.87
34.12 OFF
12.23

etc

I want to find the row that does not hold a value price. How can i find it.
I need the row 34.12 OFF to be retrieved for the illustration.
0
Comment
Question by:TECH_NET
  • 4
  • 3
7 Comments
 
LVL 17

Expert Comment

by:Chris Mangus
Comment Utility
Select X From myTable where IsNumeric(X) = 0

This will catch any non numeric rows.
0
 

Author Comment

by:TECH_NET
Comment Utility
It works great. Exactly what i wanted. Now another question.

one of the value of the price column was

Skil 7.2-volt Lithium-Ion Power Wrench -

How can i update the another column Y, with the value of the PRICE, and if the column Y has a value , can i append the value of the PRICE column to value of column Y.

I increased the points to 500
0
 
LVL 17

Expert Comment

by:Chris Mangus
Comment Utility
Update myTable Set Y = IsNull(Y, '') + IsNull(X, '')
Where IsNumeric(X) = 0

The IsNulls are there to catch any instance where you don't have an existing value in Y or in the event the data in column X is null.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 17

Expert Comment

by:Chris Mangus
Comment Utility
My code will update all of your Y columns.  Are you wanting to do this on a row-by-row basic?
0
 

Author Comment

by:TECH_NET
Comment Utility
yes, i want to update only rows where the column of price is not numeric,
0
 
LVL 17

Accepted Solution

by:
Chris Mangus earned 500 total points
Comment Utility
Then my code will work as written.  Obviously, if you wanted to do it on specific rows you'd include your PK in the Where clause.
0
 

Author Closing Comment

by:TECH_NET
Comment Utility
Thank you for your quick responses.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

11 Experts available now in Live!

Get 1:1 Help Now