[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Error converting data type varchar to float.

Posted on 2006-07-06
1
Medium Priority
?
634 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 2000 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

656 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