Advertisement

05.24.2008 at 03:50PM PDT, ID: 23430449
[x]
Attachment Details

How do I fix this Sql select statement ?

Asked by mdcarr in SQL Server 2005

Tags: Sql Server 2005

Hello,

First thank you for your time.

My table is of the form:
Column1:  Column Name=Id, Data Type=int
Column2:  Column Name=Balance, Data Type=nvarchar(20)

The data in the table looks like this:
Row1:  1, $15,000.00
Row2:  2, $2.00
Row3:  3, -$15.45

When I execute this query:
select * from Clients where Balance > '$15'
 
I get the following result set returned:
Row1:  1, $15,000.00
Row2:  2, $2.00
Row3:  3, -$15.45

I was obviously only expecting to see Row1.

What is going on here?  I would like to use the nvarchar data type.  Is there a way to alter the structure of the query to get the proper result?  Or must I use the Money data type?

Thank you for your time.
Michael
Start Free Trial
[+][-]05.24.2008 at 04:12PM PDT, ID: 21640555

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.24.2008 at 04:14PM PDT, ID: 21640558

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.24.2008 at 04:34PM PDT, ID: 21640599

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.24.2008 at 05:11PM PDT, ID: 21640696

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Server 2005
Tags: Sql Server 2005
Sign Up Now!
Solution Provided By: LordOfPorts
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.24.2008 at 05:55PM PDT, ID: 21640787

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628