473,503 Members | 3,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Output type of following query

shilpa george
15 New Member
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
Jan 20 '12 #1
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.
Jan 20 '12 #2
shilpa george
15 New Member
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?
Jan 25 '12 #3
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".
Jan 25 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1764
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...
1
4004
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
2
2576
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...
0
921
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?...
1
11390
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 ...
2
1788
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...
1
2081
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
1
1995
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...
2
1422
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,...
1
2001
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...
0
7188
marktang
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,...
0
7258
Oralloy
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,...
0
7313
jinu1996
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...
0
7441
tracyyun
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...
0
5558
agi2029
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,...
1
4987
isladogs
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...
0
4663
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...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.