how can i convert varchar to numeric

i am sending string like(1,2,3) by VB and want this string to used with
In operator.but my problem is this that when i am using this in my sql
select statement error occurs b'coz the table field by which i am
quering is numeric.


--
Posted via http://dbforums.com
0
pragya
10/13/2003 9:37:14 PM
sybase.ase.general 8655 articles. 0 followers. Follow

1 Replies
620 Views

Similar Articles

[PageSpeed] 42

On 13 Oct 2003 14:37:14 -0700,
 in sybase.public.ase.general
pragya <member41060@dbforums.com> wrote: 
>i am sending string like(1,2,3) by VB and want this string to used with
>In operator.but my problem is this that when i am using this in my sql
>select statement error occurs b'coz the table field by which i am
>quering is numeric.
>
>
>--
>Posted via http://dbforums.com


Hi Pragya,

Do you mean you are generating a query like this:

select name, address, zip from my_table
where zip like (1,2,3)

note: the zip is a numeric

If so, it won't work as LIKE requires char/varchar.  You would be better off
writing it like so:

select name, address, zip from my_table
where zip in (1,2,3)

hope this helps

Jason L. Froebe
TeamSybase (http://www.TeamSybase.com)
International Sybase User's Group (ISUG http://www.isug.com)
http://www.bookcrossing.com
0
Jason
10/13/2003 10:08:54 PM
Reply:

Similar Artilces:

Using CONVERT function to convert NUMERIC to VARCHAR
I am creating a trigger on a table where 2 columns are defined as numeric. This trigger captures the data and inserts it into another table where I want to combine the numeric data with a statement. I've tried using the CONVERT function, but it is giving me a mis-matched token error. I've looked through the documentation online, but it is not really helping me or I'm not understanding correctly. I've pasted a snippet of what I'm trying to do without using the CONVERT function. **user_level and region_id are the numeric values** select @whatchanged = case ...

Convert numeric to varchar
Hi, does anybody know how I can convert a number to a character datatype so that leading zero's will be in the result. E.g.: 56 -> '0056' TIA. Regards, Jan Hello, I believe that the easiest way is to just add zeros to the string. Example) SELECT "0000000000" + CONVERT(VARCHAR(10), @VALUE) You could also you replicate, stuff and other various system functions to perform this, but I believe the above is the easiest. /* Good for positive numbers only. */ 1> select field1, "Positives Only" = 2> right( replicate(&quo...

error converting varchar to numeric
i have a huge stored procedure abt 500 lines..and i am calling this sp from an asp.net page...thn i got this error - error converting varchar to numeric - and am trying to debug...is there any way we can find out where the error is coming from...like aproxly which line number..etcor do i have to go through each line manually and see where i am doing the conversion.... thanks***********************Dinakar NethiLife is short. Enjoy it.*********************** Never tried it myself but it should let you step through a sproc like you would your C#/VB.Net code behind. Walkthrough: Debuggin...

Error converting data type varchar to numeric
hi All, This case statement is giving me the error "Error converting data type varchar to numeric". the column dbo.tblKMTermloanFees.base_min datatype is varchar.  And please see below for sample data in the column. i have to convert this into number. Any suggestions guys how to do this, Thanks in advance. Shilpa.  CASE  WHEN dbo.tblKMTermloanFees.base_min LIKE '%/6M%' THEN CONVERT (DECIMAL (5,2), LEFT (Base_Min, CHARINDEX ('/', Base_Min)-1)) / 6 WHEN dbo.tblKMTermloanFees.base_min LIKE '%/M%' THEN CONVERT (DECIMAL (5,2), LEFT (Base_Mi...

Error converting data type varchar to numeric.
following is the error I am getting. Exception Details: System.Data.SqlClient.SqlException: Error converting data type varchar to numeric.Source Error: Line 107: " select '" & eventnumber & "','" & username & "','" & requestor & "', '" & bcode & "', max([Loan_ID]) from loan "Line 108: Dim myCommand1 As New SqlCommand(sql1, myConnection)Line 109: myCommand1.ExecuteNonQuery()Line 110:Line 111: Dim sql2 As String = " update Equipment set [Available_for_Loan] = 0 where barcode = '" &am...

how i convert varchar sal field to numeric in query
how i convert varchar sal field to numeric in query select sum(sal) from emp1 error:the sum or average aggregate operation cannot take a varchar data type as an argument. Use Cast as in: select sum(cast(sal as float)) from emp1...

Can't construct query plan in ASE 12.0
Error 325 is being returned when trying to execute a stored procedure on version : Adaptive Server Enterprise/12.0/P/SWR 8773 ESD 1/RS6000/AIX 4.3.2/1580/64bit/FBO/Tue Dec 7 03:29:32 1999 ... this is the code causing the error when running on version listed above... it's a sub-query within a stored proc AND SBSB.HIST_ROW_ID = (select MAX(SBSB2.HIST_ROW_ID) FROM Massive_db.audit.CMC_SBSB_SUBSC SBSB2 WHERE SBSB2.SBSB_CK = SBSB.SBSB_CK AND CONVERT(CHAR(10),SBEL.SBEL_INSQ_DT,101) = CONVERT(CHAR 10),SBSB2.HIST_CREATE_DTM,101)) When executing same stored procedure on AS...

Arithmetic overflow error converting varchar to data type numeric
Hello, i am getting "Arithmetic overflow error converting varchar to data type numeric"  while i am trying to cast the numeric value to varchar in SQL Server 2000(This is the Query  (cast(' + @Qty + ' as varchar(50)) If any knows plz help me, thanks.        "Arithmetic overflow error converting varchar to data type numeric" stands for error while converting varchar to numeric, and you say "trying to cast the numeric value to varchar", this is kind a confusing thing. Can you explain your problem more detailed?Nev...

How to convert numeric primary key into identity? ASE 12.5.2
How to convert numeric(19,0) primary key into identity? I have some tables with data where primary key is numeric(19.0). I need to convert such id into identity to allow auto increment. As I understand new next value problem must be solved somehow too. Any help? Using ASE 12.5.2 > How to convert numeric(19,0) primary key into identity? > I have some tables with data where primary key is > numeric(19.0). I need to convert such id into identity to > allow auto increment. As I understand new next value > problem must be solved somehow too. Any help? > Using ASE 12.5....

Can't pass a varchar into a proc on ASE 12.5.4
Using Sybase 12.5.4 and have written a query using Windows Reporting Services 2000. The problem that I am getting is that I am unable to pass strings into stored procs that are residing on my server. I get "An error has occured during report processing. Query Execution failed for data set 'trader'. The given type name was unrecognized. It also doesn't work from the Windows Reporting Service through ODBC. However it works from an ISQL session through ODBC. Any ideas... On 4 Nov 2009 07:39:04 -0800, Liezl wrote: You may have to setup a trace (Ribo or sniffer) b...

Can't access NUMERIC type in ASE via EAServer4.1.1
The problem is: When accessing NUMERIC column of Sybase ASE12.5 db table, errors occur: Servlet jspservlet: unable to service request: null It is tedious, this problem is OK for the newly installed EAServer4.1.1 & ASE12.5 machine. However, after some time running with publishing application on EAServer, this problem appears. We don't have the exact steps to reproduce this error. Does anybody know the reason? It is urgent for us!!! Additional information: (1) table creation CREATE TABLE mobile.dbo.TEST ( ID numeric(28,...

PB 11.2/MS SQL 2005 Error converting data type varchar to numeric
Am getting the above error from PB 11.2 when executing a stored proc. The proc take no parameters. Once i get this error, i cannot execute the proc succesfully from PB 11.2 until i recompile the stored proc. At the same time the proc works fine from Query Analyzer, as well as from PB 7. What is PB 11.2 doing to mess this up? Any ideas....it's wrecking havoc on our production app. Forgot to add the error is C0195:SQLSTATE =3D 22018 On Dec 13, 4:00=A0pm, bre...@friesens.com wrote: > Am getting the above error from PB 11.2 when executing a stored proc. > The proc take no...

Windows Reporting Service: can't pass varchar into proc on ASE 12.5,4
Using Sybase 12.5.4 and have written a query using Windows Reporting Services 2000. The problem that I am getting is that I am unable to pass strings into stored procs that are residing on my server. I get "An error has occured during report processing. Query Execution failed for data set 'trader'. The given type name was unrecognized. It also doesn't work from the Windows Reporting Service through ODBC. However it works from an ISQL session through ODBC. Any ideas... Liezl, I think I dealt with a similar problem several years ago... What ODBC driver version are...

ASE to ASE
Hi, Is anyone out there doing ASE to ASE replication using SQL remote? If you are have created your own version of the SSEXTRACT utility to set up a replicant database in ASE rather than ASA? Or does anyone know if SYBASE has created a version SSEXTRACT for use with ASE to ASE replication? Thanks in advance Doug Trainer Hi Douglas, I thought the SQL Remote Replication support in ASE11.5 was meant for a consolidate-database only (by design)! At least that was what Sybase said when they announced support for SQL Remote technology support in ASE11.5. I will be happy to...

Web resources about - how can i convert varchar to numeric - sybase.ase.general

File:Convert to SVG and move to Commons.svg - Wikipedia, the free encyclopedia
As a courtesy (but not a requirement), please e-mail me or leave a note on my talk page if you use this image outside of Wikipedia. Thanks! As ...

Facebook Co-Founder Dustin Moskovitz Sells 450K Shares, Converts 7M More
The great Facebook stock sale frenzy continues on with a report that Co-Founder Dustin Moskovitz unloaded 450,000 shares in the social network ...

Facebook Announces “App2User” Liquidity Program for Merchants to Convert Rewards Points into Credits
... for Credits, just announced a new Credits program called “App2User,” designed to enable merchants and loyalty program operators to convert their ...

How to Convert Leads Into Buying Customers - The 9 Step Sales Process EVERYONE Should Use
... School of Business in Toronto on the topics of Sales and Entrepreneurship. I shared with them the sales process that I find How to Convert Leads ...

Bitcoin : Should I convert my savings to Bitcoin?
Answer (1 of 7): You should think of this question as "Should I invest all my savings in Bitcoin?", and not "Should I have my savings denominated ...

Convertizo 2 - Convert Units and Currency in Style on the App Store on iTunes
Get Convertizo 2 - Convert Units and Currency in Style on the App Store. See screenshots and ratings, and read customer reviews.

Catholics should not convert Jews, says Vatican, in push against anti-Semitism
... 50 years since the Vatican's repudiation of the concept of Jewish guilt for Jesus' death.  Vatican City: Catholics should not try to convert ...

Opinion: These 5 things made me a happy iPad Pro convert
... like I needed a bigger device. But after three weeks with my iPad Pro, several things have changed my mind, and I’m officially a happy convert ...

$100 device converts all your film to digital photos
... still on film negatives. Today, we've got the perfect Amazon Cyber Week deal for you: A Wolverine F2D Mighty 20MP 7-in-1 Film to Digital Converter ...

"ISIS 'ranks' the women, considering foreign women and converts to be especially 'valuable.' "
"According to French journalist Anna Erelle’s recent exposé , ISIS foreign fighters prefer foreign women and converts because the jihadists find ...

Resources last updated: 12/14/2015 4:08:43 AM