Hello,
I have an sql query as following. Could you please tell me how the right function works? When the date is given in quotes
right('1990-05-23',5) returns 05-23
otherwise
right(1990-05-23,5) returns 1990...could you please help with this?
Also,the query returns 0.
select right('1990-05-23',5)<right('1995-02-03',5)
In sql does 0 represent a true or false?
Thank you in advance
3 1740 Rabbit 12,516
Recognized Expert Moderator MVP
Right returns the x number of characters of a string starting from the right most character.
What you have in your first example is a string, not a date.
Your second example isn't even returning the correct result. It should 1962. Because without quotes, what it is is 1990 minus 5 minus 23, which is 1962. Which is then converted to a string '1962', and then the right 5 characters are returned which is '1962'. If you are getting 1990 instead of 1962, then either you posted the wrong SQL or something else is wrong.
Your third example shouldn't even run, it should error out.
None of the queries you posted would return 0. SQL has no concept of true or false. That is a human construct and is up to you to determine. But the norm is to use 0 as false.
Thank u Sir
As you have said the second example,
select right(1990-05-23,5) returns 1962..
But the third example
select right('1990-05-23',5)<right('1995-02-03',5)
returns 0
and when given as
select right('1990-05-23',5)>right('1995-02-03',5)
returns 1
I have provided the same query as I have used still I am getting this output.... I am using MySQL Front as database...
Could you please tell me how this comparison is done?
Rabbit 12,516
Recognized Expert Moderator MVP
You are using MySQL? You posted in the Microsoft SQL forum. In Microsoft SQL, that results in an error. You have to ask your question in the correct forum. But if I had to guess, it takes the right 5 characters of each string and then does a ascii value comparison letter by letter to evaluate which string is "larger".
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Nate |
last post by:
Hello,
I'm just learning C# on visual C# .net (my apologies if
this is not the apropriate forum for this question), and
I'm having a problem when I create empty windows
applications. Whenever I...
|
by: Heng Ma |
last post by:
Hi,
Somehow when I open a project the project Output Type is always changed
to Windows Application. What is happening?
--Heng
|
by: Mark |
last post by:
Visual C# .Net Standard 7.1.3088
I'm trying to change the type of application from a windows to a console
app. I go into the project properties --> Application -->
According to the help, I...
|
by: Roman S. Golubin |
last post by:
Hello everybody!
I have been installed Visual C#.Net 2003 Standard and I don't found "Output
type" switch in project properties ????!!! ;-(((
Can someone help me for correct this mistake?...
|
by: bi |
last post by:
hi I am currently getting the following issue with webservices, anyone got
any ideas? this only just started happening.
a project with an output type of class library cannot be started directly
...
| |
by: Eckhart |
last post by:
Dear All, Plz help me in optimising the following query,
Reduce repeatable reads from the table via select ,ythe table sare not
having referntial integrity constarints ,relations
CREATE proc...
|
by: mgonzales3 |
last post by:
I have a windows app that i want to be able to run at the cmd line.
Using vs2005 can I determine the Output Type at runtime?
or can I set this value at runtime?
thanks
|
by: studio60podcast |
last post by:
I have a solution I inherited from previous developers that includes
web projects whose output type = class library. I need to add web
forms and web user controls, but when I try to add them, it...
|
by: kshirsagar007 |
last post by:
friends,
I would like to optimize the following query....as its taking 2 minutes to get the records.
select a.CODE "Code",
ud.Name "Name",
a.SchemeId "SchemeID"
from (MASTER sh,...
|
by: rajeev14th |
last post by:
How can i modify the following query in DB2
(CAST(SUBS_REFILL_COUPONNO_CHANNELID AS INTEGER) (FORMAT '9(16)') (CHAR(16)) )
where SUBS_REFILL_COUPONNO_CHANNELID is the column name of my table...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |