Conversion of date to float
Can anyone tell me how to convert the date value to float value
Ex now i have a val 30-jul-2007
this i need to insert as 20070730 i.e yyyymmdd as that field data type is float
or give me a function for changing the date format as we use format in sql server???
Thanks in Advance
michaels> with tab as (select '30-jul-2007' dt from dual)
select dt,
to_number(to_char(to_date(dt,'dd-mon-yyyy'),'yyyymmdd')) fl
from tab
DT FL
30-jul-2007 20070730
Similar Messages
-
Open conversions in data dictionary
Dear experts,
We have been trying to install an ST-PI package in an SAP system.However,it gives a warning saying "Open conversions in data dictionary". It says - Some open conversion requests still exists for the following ABAP data dictionary objects.To avoid inconsistencies and data losses you must process these conversions first.
Further it asks us to run the transaction SE14 which points towards the table GLPCA and says Index Z1 does not exist.
What can be the cause behind this?I do not have an ABAP background.So,hoping if you could help me out.
Regards,
Minuj
Edited by: minuj sarma on Feb 22, 2008 2:12 PMhi sagar,
Go to transaction SE14 and choose the following options in the menu
DB requests --> Terminated
Reward points if usefull,
Thanks,
Kalyan. -
Implicit Conversion from data type sql_variant to datetime is not allowed.
Getting a odd error. This code was working perfectly before a SQLServer upgrade.
The linked database is working, I'm able to pull up data from it in separate queries just fine.
I'm getting the following error.
Implicit conversion from data type sql_variant to datetime is not allowed. Use the CONVERT function to run this query.
Invalid column name 'TotalDay'. (.Net SqlClient Data Provider)
can anyone spot the issue? I've tried sever variations of the same code, but still get the same thing.
If I put this section in a query by it self it works just fine.
( DATEDIFF(ss,
CONVERT(VARCHAR(10),( SELECT TOP ( 1 )
TimeDate
FROM [nav].AcsLog.dbo.EvnLog AS X3
WHERE UDF2 = E.No_
AND CONVERT(VARCHAR(10), X3.TimeDate, 101) = CONVERT(VARCHAR(10), @sdate, 101)
ORDER BY TimeDate ASC
),101),
CONVERT(VARCHAR(10),( SELECT TOP ( 1 )
TimeDate
FROM [nav].AcsLog.dbo.EvnLog AS X4
WHERE UDF2 = E.No_
AND CONVERT(VARCHAR(10), X4.TimeDate, 101) = CONVERT(VARCHAR(10), @sdate, 101)
ORDER BY TimeDate DESC
),101)) ) AS TotalDayBadge ,>ANDCONVERT(VARCHAR(10),X3.TimeDate,101)=CONVERT(VARCHAR(10),@sdate,101)
It is not a good idea to use string dates for predicates in WHERE clauses.
Use DATETIME or DATE in predicates.
If you are not interested in the time part of DATETIME, use DATE datatype.
Example:
SELECT CONVERT(DATE, getdate());
-- 2014-08-25
Datetime conversions:
http://www.sqlusa.com/bestpractices/datetimeconversion/
Between dates:
http://www.sqlusa.com/bestpractices2008/between-dates/
Kalman Toth Database & OLAP Architect
SQL Server 2014 Design & Programming
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012 -
I acquired data in DAQmx by PXI4472. For the high speed data logger, I used "DAQmx Read" to read unscaled 32-bit signed integer data.
Now, my question is how to scale 32-bit signed integer data to floating-point voltage?
I think that it's (20/(2**24))*I32 because the voltage range of PXI4472 is -10 to +10 and its resolution is 24 bits. But I cann't get correct voltage by that formula.While you could hard code the scaling factor, it will be more flexible if you retrieve the scaling coefficients from the driver. To do this, you need to use the Analog Input>>General Properties>>Advanced>>Device Scaling Coefficients>>Device Scaling Coefficients properties under the DAQmx Channel Property Node. Look at the documentation for this property to see how it can be used to create a polynomial equation for scaling to volts.
Since you are creating a data logging solution, you may want to consider using a compressed data stream from the driver instead of the I32 data type. This will allow you to read the data back as a stream of u8's instead. Since the PXI-4472 is 24 bits, you will only have to write 3 bytes to disk for each sample instead of 4. You can check out the following examples for how to create an application using this compressed data stream. It also shows how to use the scaling coefficients to transform the unscaled data back to voltage values. -
While using the bulid in data type float .
we get output Like 123.440000000000000000000+e0
i just want to print upto 2 places of deicmal.
please help.Hi Lokesh,
use statement:
write variable_name decimals 2.
where variable_name is of type f or p.
Regards,
yellappa. -
Disallowed implicit conversion from data type datetime to data type timestamp
Received error: [Macromedia][SQLServer JDBC
Driver][SQLServer]Disallowed implicit conversion from data type
datetime to data type timestamp, table 'myTbl', column 'duration'.
Use the CONVERT function to run this query.
I have a field named duration hh:mm:ss.lll that I am trying
to insert into MS SQL. DB has field defined as [duration]
[timestamp] NOT NULL,
My insert has this: INSERT INTO myTbl( duration) VALUES(
<cfqueryparam value="2006-05-26 11:12:13"
cfsqltype="CF_SQL_TIMESTAMP"/> )
Why does this not work? rrrrrrrrrrrrrr! BTW: also tried with
seconds as 13.111 which did not work. Does the db duration need to
be date? I just want to store a duration for the time of a movie...
10 Qquote:
Originally posted by:
quiet1
Received error: [Macromedia][SQLServer JDBC
Driver][SQLServer]Disallowed implicit conversion from data type
datetime to data type timestamp, table 'myTbl', column 'duration'.
Use the CONVERT function to run this query.
I have a field named duration hh:mm:ss.lll that I am trying
to insert into MS SQL. DB has field defined as [duration]
[timestamp] NOT NULL,
My insert has this: INSERT INTO myTbl( duration) VALUES(
<cfqueryparam value="2006-05-26 11:12:13"
cfsqltype="CF_SQL_TIMESTAMP"/> )
Why does this not work? rrrrrrrrrrrrrr! BTW: also tried with
seconds as 13.111 which did not work. Does the db duration need to
be date? I just want to store a duration for the time of a movie...
10 Q
Duration as a timestamp? How odd, most people would store it
as an integer. Or, if you want to build your own string, the syntax
is {ts 'yyyy-mm-dd hh:mm:ss'}. The seconds might not be required.
In any event, use createodbcdatetime() for the value you want
to put into your table. -
Conversion of Data between 3.1 to 7.0
Hello Everybody,
I have a need to convert a large volume of data from BW 3.* to 2004s. Due to the volume of data what would be the best conversion practice.
1. I create a RFC between the system and create export data source out of 3.* box and extract the data in 2004s.
2. Create a flat .CSV files from BW 3.* and upload the files into the 2004s server (file copy) and load it as a flat file load.
I am considering ease of use, performance, and no data loss. Please advice what would be the better option. I am leaning toward option 1. Please tell me what is the better approach?
Thanks,
Alex.Hi Alex,
I guess that when you say Convert you mean to copy the information.
The best option is number 1, create the 3.1 system as a source system for the 7.0 system and upload data using infopackages.
Hope this helps.
Regards,
Diego -
Conversion from date to number & display a date in a textfield
I Have 2 issues
The first one:
I need to extract the hour from a date variable.
This is the code I already have:
NUM_TOT := NUM_TEL + to_number('PROGRAMMINGS1.PRG_START','hh24');
NUM_TOT & NUM_TEL are number variables,
PROGRAMMINGS1.PRG_START is a Textfiel with a dateformat. There can only be an houre like 24:59:00 entered.
So in this example I just want the houre and convert it to a number.
The second:
I want to make a date from a few numbers & then display it in a texfield.
This is the code I already have:
VAR_DATE := NUM_TEL || ':' || NUM_LENGTH || ':00';
:PROGRAMMINGS.PRG_END := to_date(VAR_DATE,'hh24:mi:ss');
Between the 2 lines of code i places a message(VAR_DATE) for testing.
When the program display VAR_DATE then i can see the good date at the bottom of the screen.
But when I place my variable in the textfield it looks like: 00:00:00. What am I doing wrong?
Who can help me.
With regards
StefanieVerdi wrote:
Problem: During the conversion (both implicit and explicit conversion with a format mask) I lose the "00" hours and "00" minutes and receive something like this: "10-JAN-13 *12*.00.00.000000000 AM".I don't think you are necessarily losing any information whatsoever. It's probably more of a function of your NLS_TIMESTAMP_FORMAT and NLS_DATE_FORMAT. For example your NLS_DATE_FORMAT could be setup by default for a HH24 (24 hour time) which would report midnight as "00" hours. However, it looks like your NLS_TIMESTAMP_FORMAT is setup with a "HH" format with a meridian indicator which means 12 hours time.
Your comparisons should be using date/timestamp data types anyways so as long as the input value is converted properly into a date type this shouldn't matter anyways.
You can see what is actually stored by using the DUMP function:
SQL> SELECT DUMP(TO_TIMESTAMP(TO_CHAR(TRUNC(SYSDATE,'DD'),'MM/DD/YYYY HH:MI:SS AM'))) AS TSTAMP
2 , DUMP(TRUNC(SYSDATE,'DD')) AS DT
3 FROM DUAL
4 /
TSTAMP DT
Typ=187 Len=20: 218,7,1,13,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0 Typ=13 Len=8: 218,7,1,13,0,0,0,0As you can see the TSTAMP and DT store nearly the same values (218,7,1,13), but the TSTAMP has more precision because of fractional seconds.
HTH!
Edited by: Centinul on Jan 13, 2010 7:23 AM -
Need help in Report.... Conversion of data elements
Hi All,
Iam doing a report. Chk the code below
SELECT roleid
FROM SRRELROLES
INTO gs_roleid
WHERE objkey = gs_guid
AND objtype = BUS2010020.
When i activate this it is throwin an error sayin dat <b>" GS_GUID and OBJKEY is not mutually convertible in a unicode program.... "</b>
<b>Here objkey is RAW 16 and gs_guid is char(70)..</b>
Can anybody help me out in this... and is there any conversion routines for doing this.
Thanks,
Shiva shekar kdeclare a gs_guid variable as raw data type .. and then convert it to char
and for conversion refer
convert raw type to char
Convert RAW 1022 TO CHAR 255
Convert RAW 1022 to CHAR 255 -
Supplier Conversion - Sites data - Country code
Hi,
While doing Supplier conversion from release 11.5.10 to R12.1.3, we see the below value in REJECT_LOOKUP_CODE column of the AP.AP_SUPPLIER_INT_REJECTIONS table:
'AP_NULL_COUNTRY_NAME'
As I understand this looks like the program is looking for a Country code. The country code column is a Nullable column in the AP_SUPPLIER_SITES_INT table, so not sure where validation happening. In 11i data, there are records that do not have the Country code set up and we are tying to bring those in to R12. Any one faced this issue, any ideas / work-around?
Is the program validating the data against any seeded lookups in oracle apps?
Thanks,
gg.Hi Vidhu,
Every supplier will have a site meant for different purposes ... at the backend they are stored in AP_SUPPLIER_SITES_ALL table ...
If you query this table, you can find the list of supplier sites that are enabled for Purchase Site assignment and Payment Sites assignment ....
i.e.
Select VENDOR_ID, VENDOR_SITE_ID, ORG_ID, PURCHASING_SITE_FLAG, PAY_SITE_FLAG from AP_SUPPLIER_SITES_ALL
From Vendor ID you can find the supplier name and number from AP_SUPPLIERS table
From Vendor Site ID you can find the supplier site name from AP_SUPPLIER_SITES_ALL table
From ORG_ID you can find the operating unit name from HR_OPERATING_UNITS
I would recommend enabling the Pay_site_flag for the supplier sites that are enabled for Purchase site flag and assigned to operating unit already .....
Since you cannot create Invoice for a supplier site, if the site is not enabled for Pay_Site_flag, and you cannot create purchase order for a supplier site, if the site is not enabled for Purchasing_site_flag... hence from business perspective they need a site in every operating unit which is enabled for Pay_site_flag and Purchasing_site_flag ...
Regards,
Ivruksha -
Conversion from DATE to TIMESTAMP datatype
Hello,
My issue is as follows:
1. I have one variable of type DATE, which I assign the value of SYSDATE
mydatevar DATE:= SYSDATE;2. I want to find *"today"*, truncated to DAY
TRUNC (mydatevar, 'DD')
TRUNC function returns DATE datatype. So I will receive in point 2 for example *'2010-01-13 00:00:00'*.
3. I want to assign the value from point 2 to a variable of type TIMESTAMP
mytimestampvar TIMESTAMP := mydatevar;which implicitly will convert the DATE variable to TIMESTAMP.
Problem: During the conversion (both implicit and explicit conversion with a format mask) I lose the "00" hours and "00" minutes and receive something like this: "10-JAN-13 *12*.00.00.000000000 AM".
Question: How can I convert from DATE to TIMESTAMP keeping hours and minutes zeros?
Why I need this conversion: I have a table with a column "column1" TIMESTAMP(0) and I would like to take only those rows from the table, where "column1" is in range from today 12 o'clock in the morning till now (whatever hour it is).
NLS characteristics of the database:
PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET AL32UTF8
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_RDBMS_VERSION 10.2.0.4.0Session parameters are the same.
DBTIMEZONE is "+02:00".Verdi wrote:
Problem: During the conversion (both implicit and explicit conversion with a format mask) I lose the "00" hours and "00" minutes and receive something like this: "10-JAN-13 *12*.00.00.000000000 AM".I don't think you are necessarily losing any information whatsoever. It's probably more of a function of your NLS_TIMESTAMP_FORMAT and NLS_DATE_FORMAT. For example your NLS_DATE_FORMAT could be setup by default for a HH24 (24 hour time) which would report midnight as "00" hours. However, it looks like your NLS_TIMESTAMP_FORMAT is setup with a "HH" format with a meridian indicator which means 12 hours time.
Your comparisons should be using date/timestamp data types anyways so as long as the input value is converted properly into a date type this shouldn't matter anyways.
You can see what is actually stored by using the DUMP function:
SQL> SELECT DUMP(TO_TIMESTAMP(TO_CHAR(TRUNC(SYSDATE,'DD'),'MM/DD/YYYY HH:MI:SS AM'))) AS TSTAMP
2 , DUMP(TRUNC(SYSDATE,'DD')) AS DT
3 FROM DUAL
4 /
TSTAMP DT
Typ=187 Len=20: 218,7,1,13,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0 Typ=13 Len=8: 218,7,1,13,0,0,0,0As you can see the TSTAMP and DT store nearly the same values (218,7,1,13), but the TSTAMP has more precision because of fractional seconds.
HTH!
Edited by: Centinul on Jan 13, 2010 7:23 AM -
Regarding conversion of date in wd abap
Hi All,
I have created an ui element i.e a table and in that one row is for getting the date of birth.i have binded this table with a table which is in dictionary structure. while running my application I am not getting the date of birth in correct format.
say for example i require the correct output i.e DOB as 01.01.1970 but i am getting the wrong output in this field as 19700101.so if there is any function module or any way to do the date conversion then give it.
Thanking you All in advance.hi,
Use this FM CONVERSION_EXIT_PDATE_OUTPUT.This will always converts from system(YYYYMMDD) to user format.
Thanks,
suman -
Regarding conversion of date in abap
Hi All,
while running my application I am not getting the date of birth in correct format.
say for example i require the correct output i.e DOB as 01.01.1970 but i am getting the wrong output in this field as 19700101.so if there is any function module or any way to do the date conversion then give it i.e. how can I convert the date from string to date format.If any one knows the solution then revert me back.
Thanking you All in advance.say your user setting format is mm.dd.yyyy
now, data: v_date like sy-datum.
move the data to V_date.
write:/ v_date.
as your user setting format is mm.dd.yyyy it displays as 01.01.1997 although internally it stores as 19970101 -
Conversion of Date field to 0FISCPER
Hi,
I have a field ZDATE from old legacy system.
The format of this field is like 05 - MAJ ; 06 - JUNI; 07 - JULI and so on.
I need to map this field to 0FISCPER in the BW system
Please advice a code for a conversion routine as such.Hi john,
Greetings.
For converting it to 0FISCPER, you will need the information of Year as well.
We will have to perform the operation in 2 steps.
1). To convert the legacy date into YYYYMMDD Format.
2). Once we achieve the first part, we can use the Function module 'DATE_TO_PERIOD_CONVERT' by passing the date and it will return the period and year. and you can pass the period to the result.
Sample code is as below. Let me know if it helps.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = wa_result-calday
i_monmit = 00
i_periv = 'Z2'
IMPORTING
e_buper = l_period
e_gjahr = l_year
EXCEPTIONS
t009b_notfound = 4
INPUT_FALSE = 4.
wa_calday-v_period = l_period.
Thanks
Sachin -
Regarding Conversion to date in OBIEE
Hi
I am pulling a date column from an as/400 source wherein I have two issues:
1. The date is displayed 19761027.0 (1976 is the year,10 is the month and 27 is the date). The data type is Integer. I need to convert this to date and in the following format mm/dd/yyyy
2. I need to add 26 to the year so that it shows the current year 2012.
How can I achieve this in the RPD? Which conversion function should i choose?
VikramVikram VV wrote:
Hi
I am pulling a date column from an as/400 source wherein I have two issues:
1. The date is displayed 19761027.0 (1976 is the year,10 is the month and 27 is the date). The data type is Integer. I need to convert this to date and in the following format mm/dd/yyyy
2. I need to add 26 to the year so that it shows the current year 2012.
How can I achieve this in the RPD? Which conversion function should i choose?
VikramCould you create a column where you would add the 260000 to the existing column and then join that on the date WID of the time dimension and retrieve the date from the Time dimension ? You could always use casting but this would give you better flexibility going forward if you ever needed anything from time dimension.
Maybe you are looking for
-
Short dump while using method start_service_direct in GOS
Hi Friends I am trying to create attachments for a business object from custom program. I have create attachment and view attachments list push buttions on the screen. when I try to create attachment, program dumps with message 'SET_HANDLER_HOBJ_NULL
-
just baked up my macbook pro to an external hard drive. my computer died on me and i plugged it in and rebooted it ,started time machine and finished backing up but. just wondering if thats good or should i delete and restart
-
Spanish layout on English keyboard
Hi, I have a new MacBook white and it ships with US keyboard layout; my native language is Spanish and I want to use the Spanish ISO keyboard layout anyway. I set up the layout properly and everything works fine: when I press the ";2 key I get the "ñ
-
DW CS4 Site Manager Buggy?
Hi: I am having trouble in my local testing environment. It all works perfectly on the Remote. When intentionally seeking a validation error, the formmail page is not returning properly. It should be: http://localhost/srbartending/srbregistermail.ph
-
Formula to calculate number of days between today's date & given date BEx
Hello, I have a date available as an attribute of dimension characteristic. How do I get current date (sy-datum) to calculate the # of days (or difference) between query execution date and given date. Is there a system field to get current or today's