Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8179505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:00:55+00:00 2026-06-07T00:00:55+00:00

I have a weird problem. In my query I select 5 columns which two

  • 0

I have a weird problem.

In my query I select 5 columns which two of them are nvarchar in the form of numeric (only contains number and precision point), and other three are uniqueIdentifier and nvarchar.

I want to cast these two columns to Float in my select statement but I’m getting an error

Cannot cast nvarchar to float.

I checked the format of all these values many many times. Trust me, they are fine.

But when I just select these two columns and cast them to float the query runs successfully.

I appreciate any help on this subject.

I can paste the query here too. but the whole query is more then 100 lines and this will be frustrating to write and read!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:00:56+00:00Added an answer on June 7, 2026 at 12:00 am

    Definitely going to need more info from you before answering. Can you post some of your code (or a small reproduction of your issue)? Perhaps your table definition as well?

    Since all of the values are numeric, why leave the column as an nvarchar?

    Finally, does any of your data contain a dollar sign ($)?

    This works:

    DECLARE @Text nvarchar(100)
    
    SET @Text = '1234.567'
    
    SELECT CONVERT(float, @Text) AS ColumnValue
    

    So does this:

    DECLARE @Text nvarchar(100)
    
    SET @Text = '    1234.567    '
    
    SELECT CONVERT(float, @Text) AS ColumnValue
    

    But this does not:

    DECLARE @Text nvarchar(100)
    
    SET @Text = '$1234.567'
    
    SELECT CONVERT(float, @Text) AS ColumnValue
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a weird problem with my mysql query syntax. I have made a
I have a weird problem. When I execute a query the data is not
I have another weird problem which I have not been able to solve in
I have a weird problem. My query in C#/ASP.NET returns results 5 times. I
I have a weird problem with my sql script. I have a string $query
I have a problem in the following code: $query = 'SELECT user.id as id,
I have a very weird problem while trying to pass and SQL query using
I have run into a rather weird problem. I have created the following query
I have a table named categories, which contains ID(long), Name(varchar(50)), parentID(long), and shownByDefault(boolean) columns.
Good day, I have this weird problem: This following statement works Query q =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.