Using RIGHT & CONVERT functions

Does anyone know why the following statement produces different results on
System 10 vs. ASE 11.5.1.

select right("00000" + convert(char(5), order_qty), 5)

10.0.3, NT 3.51 generates leading zeroes.
11.5.1.7, NT 4.0 SP 3 does not generate leading zeroes.

However, using varchar produces leading zeroes on both systems.



0
Kevin
2/19/1999 4:45:38 AM
sybase.sqlserver.general 4269 articles. 0 followers. Follow

2 Replies
255 Views

Similar Articles

[PageSpeed] 29

Hello Kevin,
Sybase changes the behaviour of handling trailing blanks from 11.0.3 to
11.5.x. This change causes the problem.

Try

select right("00000" + convert(varchar(5), order_qty), 5)

Bye Wolfgang Kunk

Kevin Kopec wrote:

> Does anyone know why the following statement produces different results on
> System 10 vs. ASE 11.5.1.
>
> select right("00000" + convert(char(5), order_qty), 5)
>
> 10.0.3, NT 3.51 generates leading zeroes.
> 11.5.1.7, NT 4.0 SP 3 does not generate leading zeroes.
>
> However, using varchar produces leading zeroes on both systems.



0
Wolfgang
2/19/1999 12:32:19 PM
Kevin,
CHAR() should always contain trailing spaces, while VARCHAR()
should always not contain trailing spaces.  Actually, 11.5+ are
now handling this correctly.  So, see if you can use VARCHAR()
in these cases to make sure you are not "handling" trailing
spaces when you deal with char() columns/datatypes but rather
forcing them to be auto-truncated with varchar().

John McVicker
Sybase Professional Services
Philadelphia, PA

Kevin Kopec wrote:
> 
> Does anyone know why the following statement produces different results on
> System 10 vs. ASE 11.5.1.
> 
> select right("00000" + convert(char(5), order_qty), 5)
> 
> 10.0.3, NT 3.51 generates leading zeroes.
> 11.5.1.7, NT 4.0 SP 3 does not generate leading zeroes.
> 
> However, using varchar produces leading zeroes on both systems.
0
John
2/19/1999 8:01:08 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 & to &
I have a Gridview that is populated by the 3 different users from selections made in a prior Form.  This gridview summarizes everything.  I then step through this Gridview and write the data to a history file on SQL. The problem I am having is, one column in this Gridview is a name column which contains the "&" symbol.  When I iterate the Gridview and populate the history file the & becomes &.  I can't seem to figure out how to convert this properly.  Both data fields are nvarchar type.  Please help anyone. This is the code to tak...

How to unencrpt the data using ".NET Function" ?
Edited by SomeNewKid. Please post code between <code> and </code> tags. Function Authenticated(email As String, password As String) As Boolean ' This method authenticates the user for the application. ' In this demonstration application it always returns ' true. Return True End Function Sub Login_Click(sender As Object, e As EventArgs) ' Create a custom FormsAuthenticationTicket containing ' application specific data for the user. Dim email As String = UserEmail.Text Dim password As String ...

& getting converted into &amp;
I am grabbing some text like "AT&T" from a database and display in a grid view. then from there I move it into another database table where it is displayed as "AT&amp;T. " How can I fix this. bendJoe:I am grabbing some text like "AT&T" from a database and display in a grid view. then from there I move it into another database table where it is displayed as "AT&amp;T. " & when encoded becomes &amp;That means somewhere along the request, you are either URL encoding the text on the client side, or before you save the data ...

Drawstring converts & to &amp;
Hello,I am using DrawString to put a copyright text on images that are posted via a webform. In my web.config I have put this: <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="nl-BE" uiCulture="nl-BE" />All works fine except that when I use chars like & or é or à or ... the text om the image converts it to &amp,...; or in other words does not seems to convert it to chars. I also write this same text to a database and there everything is normal, so & is writeen as & and é is written as é,... Why doe I have this problem and why ONLY when using the ...

CONVERT function use
I'll go right to the point: I have a textbox in wich the user can seize a "money" value. But when i'm doing the INSERT command, it fails and says I cannot implicitely convert nvarchar data (mytextbox.text) to money data. I don't know how to handle this... objCmd = New SqlCommand("INSERT INTO tbl_appel_service_pieces " & _ "(fld_nom_piece, fld_quantite, fld_prix, fld_description, fld_num_appel) " & _ "VALUES (@fld_nom_piece, @fld_quantite, @fld_prix, @fld_description, @fld_num_appel)", objConn) objCmd.Parameters.Add(&qu...

&#1055;&#1088;&#1072;&#1074;&#1072; &#1085;&#1072; &#1092;&#1072;&#1081;&#1083;&#1099; Rights to files
&#1050;&#1072;&#1082; &#1086;&#1090;&#1082;&#1083;&#1102;&#1095;&#1080;&#1090;&#1100; &#1072;&#1074;&#1090;&#1086;&#1084;&#1072;&#1090;&#1080;&#1095;&#1077;&#1089;&#1082;&#1091;&#1102; &#1089;&#1084;&#1077;&#1085;&#1091; &#1087;&#1088;&#1072;&#1074; &#1085;&#1072; &#1092;&#1072;&#1081;&#1083;&#1099; &#1087;&#1088;&#1080; &#1089;&#1086;&#1079;&#1076;&#1072;&#1085;&#1080;&#1080; ...

Ampersand (&) gets converted to &amp;
I am registering a client side javascript function on the page load. The function includes the line arrQry = strQry.split('&'); I am building the function with a StringBuilder and adding it to the header in the following fashion:Dim Include As HtmlGenericControl = New HtmlGenericControl("script") Include.Attributes.Add("language", "javascript")Include.Attributes.Add("type", "text/javascript") Include.InnerText = strScript.ToString Me.Page.Header.Controls.Add(Include) The problem is, when the script is rendered in the browser...

Use pos function from the right
Dear all, Maybe i am overlooking something, but i don't seem to find a function that uses pos function from the right of the string. Any suggestions ? Info ? HTH John Hi, Consider following example string ls1, ls2 long ll_pos ls1 = abcdefabcdef' ls2 = 'abc' ls1= reverse( ls1 ) ls2 = reverse( ls2 ) ll_pos = pos( ls1, ls2 ) HTH Arnoud Url: http://www.gloriant.be <''John''> schreef in bericht news:9E76FAC1775726C3003A875D85256BE2.003A876C85256BE2@webforums... > Dear all, > > Maybe i am overlooking some...

odd use base && use fields behaviour
This is quite a long one. Playing around with fields and base, and from reading the camel and the various man pages it seems to me that the script below (part one) should be a fairly reasonable thing to do, and still have a fairly reasonable thing happen. The problem I'm having of course is that it seems like a faily non-reasonable thing is happening. package MyNew; use fields qw ( one ); package MyNew2; use fields qw ( two ); use base qw ( MyNew ); sub new { my $class = shift; my MyNew2 $self = fields::new( $class ); } package main; my MyNew2 $...

ASP.NET &amp;amp;amp; SQLserver process going over 600megs
Hi everyone, On my server, I seem to have a problem with the aspnet_wp process getting over 630megs, which forces it to recycle (and make an entry in my error log). I have 1gig of ram on the server, and I guess it allows it 60%. I notice if I recycle the process (kill it in taskmanager), it grows and grows slowly as people access my apps, but never goes down in size. I also notice my SLQserver process grows to about 200megs when the aspnet process gets to about 600megs, so I am wondering if I have an open connection on my DLL? The main app for the box is installed in the GAC...

problem in using the convert function for date
i have a problem in sybase. select convert(char(10), dbo.classes.start_date, 101) from dbo.classes where dbo.classes.class_id = 316600 AND convert(char(10), dbo.classes.start_date, 101) >= '07/01/2001' ; i have a field start_date in the classes table.the field start date is a datetime field. i wanted to select the dates > '07/01/2001' from the classes table.there is a record in the classes table with the start_date value as 7/2/99 00:00:00 when i run the above query it gives me the record with 7/2/199 value also which i dont want.can you check is there...

Crystal Reports && Power Builder 6.5.1 && SQLServer 2k
Has anyone sucessfully integrated and deployed Crystal Reports(8.5) in a PB(6.5.1) application??? My app. seams to work fine at times but have problems sometimes too. I am thinking that my problems are due to a databse connection. Would i have to write pb code to choose a datasource and connect to database for my Crystal Reports??? I taught that once i have create a datsource for my reports this would automatically connect to the database using this datasource.Well once my reports Run Fine from the CRystal REports Application it works fine on my machine . If the reports don'...

Using sessionState mode="SQLServer" on ASP.NET 2005 using SQLServer 2000
We are upgrading our VS 2003 system to VS 2005 but do not want to upgrade our SQLServer 2000 database yet. I am piloting this upgrade to ensure a smooth transition to VS 2005. I have successfully converted the code and it runs happily when sessionState mode="InProc". However, our live site uses a web farm with two nodes. Consequently, we use mode="SQLServer" to process our sessionState. But as soon as I set this up in our test environment (having run aspnet_regsql to create the state database on SQLServer 2000), I start to get problems which I have been unable to resolve, namely; "An ...

Web resources about - Using RIGHT & CONVERT functions - sybase.sqlserver.general

Talk:Trigonometric functions - Wikipedia, the free encyclopedia
This article is within the scope of WikiProject Mathematics , a collaborative effort to improve the coverage of Mathematics on Wikipedia. If ...

Fatally weak MD5 function torpedoes crypto protections in HTTPS and IPSEC
... US Navy ) If you thought MD5 was banished from HTTPS encryption, you'd be wrong. It turns out the fatally weak cryptographic hash function, ...

Learning F# – Passing Parameters to Functions
One of the first issues I faced when learning F# was finding out how to specify multiple parameters to a function. While this might sound obvious ...

HPE Offers Catalog of Virtual Network Functions for Telcos
The vendor's OpenNFV Solution Portal gives carriers a single place to find a range of VNFs that are pre-tested to run on their networks.

7 Useful Technical SEO Functions For Your E-commerce Website
This article was co-authored by Mate Dyekiss, SEO Strategist at IMI. An e-commerce website can create all the technical SEO issues onecan imagine: ...

Using AWS Lambda functions to create print ready files
... going to tell you about our processing architecture as well as at a recent performance improvement with the integration of AWS Lambda functions. ...

Madras HC asks police to allow Tipu’s birth anniversary function
... Station on a petition filed by Ismail, General Secretary of Thamizhaga Makkal Jananayaga Katchi, seeking grant of permission to hold the function. ...

Colorado governor: This Planned Parenthood shooting may be a function of inflammatory rhetoric from bloggers ...
Via Grabien , skip to 4:45 of the clip below for the key bit. I naively thought we were (mostly) done with “climate of hate” stupidity after ...

Surprise: Binge-Watching TV May Cause a Decline in Brain Function
With the second season of Transparent only a few days away, some bad news awaits us: According to a recent study and common sense, probably, ...

1964 Archival Footage of British Soldiers Under the Effects of LSD Losing the Ability to Properly Function ...
1964 archival footage of British soldiers being given LSD-25 while training the the field. Over time they lost their ability to properly function, ...

Resources last updated: 1/12/2016 2:37:40 AM