Solved

Error converting data type varchar to float.

Posted on 2006-07-06
1
627 Views
Last Modified: 2012-05-05
With the following query

alter procedure [dbo].[Lots_GetSortedData]
@SortColumn varchar(255),
@Direction varchar(10)
as

declare @SQL varchar(8000)

    BEGIN

       SELECT @SQL = 'select ID, LOT_TITLE, COMPANY_NAME, CITY, STATE, ACTIVE, DESCRIPTION from Lots ORDER BY ' + str(@SortColumn) + ' ' + @Direction

       exec(@SQL)

    END

I get the following error

Msg 8114, Level 16, State 5, Procedure Lots_GetSortedData, Line 12
Error converting data type varchar to float.

How can i fix this?
0
Comment
Question by:rodmjay
[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
1 Comment
 
LVL 27

Accepted Solution

by:
ptjcb earned 500 total points
ID: 17051575
Which column is float? I would guess the SortColumn, but without a table description....

Anyway, add a CAST(column as varchar) to the column
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

726 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