Solved

Error converting data type varchar to float.

Posted on 2006-07-06
1
625 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
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

910 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

24 Experts available now in Live!

Get 1:1 Help Now