Solved

Error converting data type varchar to float.

Posted on 2006-07-06
1
624 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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

744 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

17 Experts available now in Live!

Get 1:1 Help Now