.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

how to do Ordering as alphabets first and Numeric ?

Posted By:      Posted Date: September 14, 2010    Points: 0   Category :Sql Server
Hello All, ORDER BY orders the value as 1) Special characters 2) Numeric 3) Characters I want to ORDER BY the values as 1) Characters 2) Numeric 3) Special Characters for Eg. 1Yamaha, Suzuki, **Ducati, Harley Davidson, 2Honda should be in the order Harley Davidson Suzuki 1Yamaha 2Honda **Ducati  Thanks.

View Complete Post

More Related Resource Links

Error converting data type varchar to numeric.


I create a form to record data using ASP.NET and SQL database...
when i run the project show error "Error converting data type varchar to numeric"

what's the problem actually.i try to change in datatype in database..
but still showing error...


Combining email and numeric regular expressions

Hi, I am using the following regular expression within an XSD to validate a combination of email ID's and six digit employee ID's separated by a semicolon (;). for example : vedansh.mm@fgfgfg.com;ghgh@ff.com;333333;555555 ^((\s*;?\s*[0-9a-zA-Z_]([-.\w]*[0-9a-zA-Z_])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})+\s*(;\d{6})*)*$ It works for the following vedansh.mm@fgfgfg.com;ghgh@ff.com;333333;555555 but does not work when the six digit number preceeds the email, like below 222333;vedansh.mm@ct.com;ghgh@ff.com;333333;555555;fhfhf@gggg.com or if the input contains only numbers, like 555555 What am I doing wrong. The numbers and email address count may or may not be the same. Thank you for all your help Vedanshu

add two numeric values

Hi, I'm trying to add two numeric values, where the one is a parameter, like this: numvalue1=numvalue1+@numvalue2 I get the error: operator does not exist:  numeric + @ numeric Then how can I add this values? I use vb.net, where I define parameters with the @ mark.

Validating Textbox for Numeric Values

I want to validate a textbox that only a numeric currency value can be put into it, for example 0.00. I thought the following code was correct but it doesnt seem to wrk, its causing an error on my page and when I remove it the page is fine, it doesn't actually give exact details of the error on the page just says "syntax error" in the browser that is all.<asp:CustomValidator runat="server" ErrorMessage="Please enter a numeric value for Night Rate in the format of 0.00" ID="NightRateNum" ControlToValidate="txtNightRate" Text="*" ClientValidationFunction="^\d+(\.\d\d)?$"></asp:CustomValidator>Would appreciate if any can tell me where I went wrong Thanks

SSRS 2008 R2 Dataset Field Value Property Data Type not numeric

We're building SSRS 2008 R2 reports using SSAS as data sources.  There are several occaissions where the data types of certain dataset field values that represent cube measures are not numeric.  As such, when these fields are used in an aggregate function they throw an error.  Is there a way to remedy this in the dataset? Thanks for your help.

Error converting data type nvarchar to numeric.

i create a form using form view tools in asp.net..when i click insert command it shows error..this is code which i use for InsertCommand:<asp:SqlDataSource ID="SqlDataSourceFormView" runat="server"         ConnectionString="<%$ ConnectionStrings:AED_PanasonicConnectionString2 %>"         SelectCommand="SELECT * FROM [Debtor]"        InsertCommand="INSERT INTO Debtor (CompanyName, Desc2, RegisterNo, Address1, Address2, Address3, Address4, PostCode)VALUES (@CompanyName, @Desc2, @RegisterNo, @Address1, @Address2, @Address3, @Address4, @PostCode)">        </asp:SqlDataSource>Error:-Error converting data type nvarchar to numeric.where i have to make changes?

Ordering in EditorFor

I have a complex view built of several layers of EdiorFor's following my graph of objects. Is it possible to specify the ordering when using EditorFor on an Entity Framework collection i.e.                      <%: Html.EditorFor(m => m.CHURCHes) %>                         <%//: Html.EditorFor(m => (from ch in m.CHURCHes orderby ch.SERVICE_YEAR descending select ch) ) %>instead of<%: Html.EditorFor(m => m.THINGs) %>to do <%: Html.EditorFor(m => (from ch in m.THINGs orderby ch.YEAR descending select ch) ) %>or<%: Html.EditorFor(m => m.THINGs.OrderBy("YEAR") ) %>(without resorting to deep copying my data into POCO objects, sorting those, and then building a view against those ?)

Problem with Conversion of numeric data from sql table to csv

I have a numeric value which is of data type Numeric(38,12) in sql server 2000. Now loading to csv what happens is 2000--data looks like 115,834,000.00 when loaded to csv ---115834000--this is how it looks. but I want it to look like as it is in the database. It would be of great help to me, if anybody can tell me the work around. Thanks, PreenSheen

valicate textbox to accept only numeric value

Hi all,  I have a asp.net webform created using c#. my text box is of type: <asp:textbox id="txtqanum" runat="server">private void txtqanum_TextChanged(object sender, System.EventArgs e) { }   it has only textchanged property. I want user to entered values between  0,1.....9. and if they entered anything else I want to show a message about invalid input. How can I accomplish this? Please help me. Thank You,

Unable to fetch text from a textbox with numeric up-down extender

I have a textbox with numeric updown extender.I want the text of the textbox.I have written code in code file is String a=txtHour.Text//  Source FIle COde<asp:TextBox ID="txtHour" runat="server" ReadOnly="True" Width="45"                     Style="text-align:center" Height="20px"></asp:TextBox>                                       <cc1:NumericUpDownExtender ID="NumericUpDownExtenderHr" runat="server"                     Enabled="True"                     Minimum="00" Maximum="23"                    TargetControlID="txtHour" Width="40">                </cc1:NumericUpDownExtender>

EXEC 17P_Comose will give incorrect syntax error. Because of numeric name

I am working with a sql server database with about 50 stored procedures. The database and stored procedureswere not created by me. The stored procedures all begin with a number in their name. Example: 17P_Comsetter The problem I am having is that if I try and execute the stored procedure at the command line in Query Analyzer,the query analyzer appears not to like that the stored procedure begins with a number. For example: If I try an run the stored procedure as follows: EXEC 17P_Comsetter Then I get the following error message:Msg 102, ..... Incorrect Syntax near '17' If I rename the stored procedure so that it does not begin with a number, then I do not get the error. The problemis that the company I am working at has a policy in place that stored procs must begin with a number.I am using SQL server 2005. Does anyone know why I am getting this error message?

Re-ordering the Columns in a ListView



I have a listview bound to a Collection 
The Grouping propertyName is speified as below. 

<CollectionViewSource x:Key="view" Source="{Binding FieldParams}">


                    <PropertyGroupDescription PropertyName="PlanValue"/> 



Also specified is a Group Style 

    <ControlTemplate TargetType="{x:Type GroupItem}" >


                                            <StackPanel Orientation="Horizontal" Background="PowderBlue" >

                                                <Border BorderBrush="Yellow"

Membership.GeneratePassword, Number of Non-Alpha numeric characters



I am using ASP.NET 2.0, SqlMembershipProvider. In web.config, the min password length is set to 10 and minRequiredNonAlphanumericCharacters is set to 0.

I want to generate random passwords that only contain alpha-numeric characters. I have tried Membership.GeneratePassword(10, 0), but the resulting passwords still contain punctuation marks.

What am I doing wrong?



Varchar to Numeric



I have a textbox where I can enter a number. If the number exists in my sql database then it would change the label accordingly. It seems to work with any input number except for numbers starting with zero. If I input a number that is 12 characters or more and  starting with zero(089470211000) do not get an error. If it is 11 characters or less  and beginning with zero (I get the error: Arithmetic Overflow error converting varchar to data type numeric.

Imports System.Data.SqlClient
Public Class ValidateForm

  Private Sub MineralCloseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MineralCloseButton.Click
  End Sub
  Private Sub CheckButton_Click(

Error converting data type varchar to numeric



I am trying to execute below query.



CAST('123,456,789.00' AS DECIMAL(11,2))

Convert Text to Numeric in reports generated by Microsoft SQL Server 2000

Our programming team is producing Excel reports using Microsoft SQL Server 2000 and cannot seem to find a way to produce numeric data as numeric.  It is being produced in the spread sheet as text (with the green triangle in the corner of the cell).  If the user viewing the report has an older version of Excel they cannot even convert it to numeric manually. 

Is there a way to produce numeric data as numeric in the Excel report?

Help with design choice -- selecting parts for ordering table


The next part of what I'm working on will involve adding parts to an order, and will be more complex than probably anything I have done.

The amount of parts to choose from will be very extensive.

Anyone care to plant the seed,  have an example, or helpful input on easy ways to select the parts,  add them to a temp table/data table/data set, until all parts are selected (?), and insert into the database when done?

Dropdowns would, in cases, have a large amount of items. Select items from a gridview Master/Detail style? Checkbox lists?

I'm not looking for code, just a point in the right direction. I've looked at some shopping cart/e-commerce type designs, but it just doesn't fit what I'm trying to do very well.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend