Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old July 20th, 2005, 09:10 AM
sonia sonia is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: London - UK
Posts: 308 sonia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 13 h 4 m 54 sec
Reputation Power: 6
sql view error annoying

i have a view which was working fine and now for some reason... it keeps on giving me this error when i try to run it..

syntax error converting the varchar value '70,157' to a column of data type int.

now 70 is a primarykey of a table and even 157.. can someone tell me what this error means ...thanks in advance...
sonia....

Reply With Quote
  #2  
Old July 20th, 2005, 02:14 PM
kcconnor's Avatar
kcconnor kcconnor is offline
Evil Republican...
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: Probably running over your cat right now...
Posts: 250 kcconnor User rank is Sergeant Major (2000 - 5000 Reputation Level)kcconnor User rank is Sergeant Major (2000 - 5000 Reputation Level)kcconnor User rank is Sergeant Major (2000 - 5000 Reputation Level)kcconnor User rank is Sergeant Major (2000 - 5000 Reputation Level)kcconnor User rank is Sergeant Major (2000 - 5000 Reputation Level)kcconnor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 21 h 35 m 23 sec
Reputation Power: 37
Is '70,157' the exact value of the varchar that is being converted to int?

When you store an int, it cannot have commas in it. When you select against an int, it will not have commas returned.

70,157 with a comma is a non-numeric string value when stored as a varchar. You need to remove the comma somehow.

Take a look at replace() in books online.

Code:
select replace('70,157', ',', '')

Once you pull the comma out, you should get an implicit conversion of a varchar to int.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > sql view error annoying


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT