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.

0
shafqat
2/1/2006 8:13:32 AM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
333 Views

Similar Articles

[PageSpeed] 50

Use Cast as in:

select sum(cast(sal as float)) from emp1

0
jcasp
2/1/2006 3:26:42 PM
Reply:

Similar Artilces:

Converting a gridView using an Sql Datasource to a gridview who is not using an SQL DataSource
How can i rewrite this page so that i doesnt make use of an SqlDataSource?  <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LoginHistory.ascx.cs" Inherits="Private_UserControls_WebUserControl" %> <html> <head> <%--<link rel="stylesheet" href="BaldwinPortal.css" mce_href="BaldwinPortal.css" type="text/css" />--%> <title>Login History</title> </head> <body style="margin:0 0 0 0;padding:0 0 0 0"> ...

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 ...

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...

How to define field attribute for a numeric field in SQL table?
I need create a field to store tax rate. I need only 2 decimal points. I defined the field as decimal, precision=5 and scale=2. Does it mean that it can hold value from 0.00 to 999.99? Actually, it should be able to hold from -999.99 through 999.99. TerriTerri MortonEngagement Manager, NeudesicHow to ask a question True... here comes my really problem. My aspx form always does rounding for me while I update the table. If I enter 0.7 it will become 0 in the table. If I enter 2.7 it will become 3 in the table. What is the trick? You'll have to show us your code surrounding th...

C# Ado.net Sql query parameter query
Hi All, I'm trying to pass in a parameter value from an array in a loop that is used in a sql query and the results are populated to an xml file. The trouble is that I'm only getting the colums values in the outputted xml file. So I feel that the paramter is not being read. So can anyone help as I'm really stuck on this one. The code is as follows : public void DisplayUserInfo() { ArrayList UserIdArrayList = IdentifyUserID(); foreach(string ShowUserIDString in UserIdArrayList) { try { SqlConnection SqlConn = new SqlConnection(DBConnString)...

Field not Found using query with decimal/numeric fields with high precision
Dear Sirs I use Interbase 7.5.1. After upgrading to Delphi XE2 from Delphi XE, when I open some IBX datasets (TIBDataset, etc), I'm getting a "Field XXX not found" exception. Everything was OK in Delphi XE. I've come to realize that the issue is with decimal or numeric fields that have high precisions (5+), e.g. Decimal (15, 5). How can I fix this issue? Please, advise Mike Norayr Monjian Mike Norayr Monjian wrote: > Dear Sirs > > I use Interbase 7.5.1. After upgrading to Delphi XE2 from Delphi XE, when I open some IBX datasets (TIBDataset, etc), I...

Datasource Sql query
 Hi, I am a coldfusion developer, but have now moved over to ASP.NET using VS2008 Pro, so trying to learn it quickly. My problem is that I have created a datasource with a simple query and when I run it in the query builder it works fine, however when I run it on the page I get nothing. Here is my query    <asp:SqlDataSource ID="qAllTrucks" runat="server"         ConnectionString="<%$ ConnectionStrings:ConnectionString %>"         ProviderName="<%$ Con...

Can sql queries be nested in sql queries?
I am having problems with a template that uses the information from one sql query to generate a query on another table. Let me be more specific. The template in question receives a category ID value from a web page that provides a menu of several categories to choose from. Each Category ID represents several Items or products to choose from. When the template receives the category ID, the first thing it does is run a query on my item_category table (this table lists all of the items and associates them with the appropriate category). This query returns several itemIDs that are all...

Converting a Query to SQL
I have the following in a Query/Filter type statement: ( (TRADE_NBR>="'001"') AND (TRADE_NBR<="96") ) The 'TRADE_NBR' is a character field. This field hold a number that is prefixed with the day of the year. So Jan 01 is "001" and today is "97". I need to get the TRADE_NBR's year-to-date using a SQL statement. I've looked at SUBSTRING, but haven't been sucessful. Any ideas? Thanks, Tom Tom Woods wrote: > ( (TRADE_NBR>="'001"') AND (TRADE_NBR<="96&qu...

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...

Problem inserting sql query into database float datatype field using SQL Transaction
I have this problem of inserting my query into database field. My code is as of below. The @AVERAGESCORE parameter is derived from Dim averagescore As Single = (122 * 1 + 159 * 2 + 18 * 3 + 3 * 4 + 0 * 5) / (122 + 159 + 18 + 3 + 0) and the value returned is  (averagescore.toString("0.00")) However, I have error inserting the averagescore variable into a field of datatype float during the transaction. I have no problems when using non transactional sql insert methods. What could be the problem?   Try Dim i As Integer ...

SQL Server Error: "Arithmetic overflow error converting numeric to data type numeric"
I'm still quite new to SQL, and so I may be missing something quite obvious. Apologies in advance if that's the case. I've included my query at the bottom of the message as it is quite long; my problem is that I get "Arithmetic overflow error converting numeric to data type numeric" when the first parameter to my COALESCE calls is not NULL. That is, the COALESCEs and the query work as I expect when SUM(cust_vw_actual.Actual) is NULL (they return 0.00), but if it isn't I get the error. I am also getting "Warning: Null value eliminated from aggregate.&...

SQL query that works in SQL Server Management Studio, but doesn't on .NET 2.0 page
SELECT favorites.FID, favorites.filename, favorites.username, files.status, files.private, files.views, files.title FROM favorites INNER JOIN files ON favorites.filename = files.filename WHERE (favorites.username = @username) AND (files.status IS NULL) AND (files.private = @private)@private is manually set to 'no'@username is set to profile.usernamewhen I run the above query in microsoft sql server mgmt studio express on the database, it presents all the information i'm asking for very easily. however when i try to implement this query on a aspx .net2.0 page with teh sqldatasourc...

sql or my sql query
hi,in my database  i have the two tables...1)programs                                2)reservedin the programs...two fields 1)program id           2)maxseats................these details wil be entered by adminin the reserved table  two fileds ..1)PRogramid        2)statusmy requirement is .. i need the available seats..meansif any body is intersted in  any program...they wil select the program...then status becomes approved(1)..then i need the o/p as ...

Web resources about - how i convert varchar sal field to numeric in query - asp.net.sql-datasource

List of converts to Buddhism - Wikipedia, the free encyclopedia
Ajahn Brahm (born 1951), Religious teacher and student of the late Thai monk Ajahn Chah . Currently he is the abbot of the Bodhinyana Monastery, ...

Facebook Timeline For Pages: 8 Million Converts, 29 Million To Go
... reach to 98 percent of users who liked its page, as well as to double its engagement rate, during a 28-day period. Dr. Pepper hasn’t yet converted ...

Facebook stock roundup: Execs offload more stock, directors convert shares
... Bowles, the former co-chair of the now-defunct National Commission on Fiscal Responsibility and Reform, and Reed Hastings, Netflix CEO, converted ...

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 ...

Coordinates - Calculate and Convert a Position on the App Store on iTunes
Get Coordinates - Calculate and Convert a Position 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 10:24:52 AM