Update of date column keeping HH:MM:SS
I am using the query below to update another parition but I am loosing time asssociated with
the data. Can somebody show me how to keep the time and only modify YYYYMMDD part of
the date
update xxx.tab1 set create_date='20110522' where
create_date >= to_date('2011/01/14', 'yyyy/mm/dd') and
create_date < to_date('2011/01/15', 'yyyy/mm/dd');
example
update xxx.tab1
set create_date=to_date('20110522','YYYYMMDD') + (create_date - trunc(create_date))
where create_date >= to_date('2011/01/14', 'yyyy/mm/dd')
and create_date < to_date('2011/01/15', 'yyyy/mm/dd');This adds a number value to your date. This number value happens to be the time portion of the create_date column.
Similar Messages
-
Update External data Column in share point2010 list
Hi all,
i have list and i am using External data column (From BCS).
I am trying to update the external data field value. its updating and showing in view correctly but when i try to edit its showing old value only.
Ex: I have a external data with field values ( test1,test2,test3,... so on)
in the list i have a value test1, i am trying to update with test2..its updating in display and view but when i am trying edit its showing default still test1..Hi,
The following articles for your reference:
SharePoint 2010 BCS Field - Setting the field/column
http://thealbuquerqueleftturn.blogspot.de/2011/12/sharepoint-2010-bcs-field-setting.html?m=1
Programmatically Setting BCS Fields in SharePoint Custom Lists Client-Side through Web Services / SOAP
http://blog.avanade.com/asg-collaboration-services/other/programmatically-setting-bcs-fields-sharepoint-custom-lists-client-side-web-services-soap/
SharePoint 2013 – Update an External Data field using PowerShell
http://veenstra.xyz/2014/06/03/sharepoint-2013-update-an-external-data-field-using-powershell/
Best Regards
Dennis Guo
TechNet Community Support -
Updating the date column in oracle databse
hi,
iam having date column called applicationdate in my oracle database.
i will update this column by jsp..
when user enter the date value he clicks update then after that iam doing following things.
String d = (String)req.getParamter("appdate");
ex:7/7/2005
preparedStatement.setString(1,d);
if i execute this statement iam getting error not a valid month .bcos in my table its long date type..so how can i convert this d value t long date type and update using seDate() method..are with setString()..
regards,String d = (String)req.getParamter("appdate");
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
java.util.Date date = sdf.parse(d);
java.sql.Date sqlDate = new java.sql.Date(date.getTime());So you got a sql.Date and u canset this on the prepared statement
ps.setDate(1, sqlDate);Watch out for the simpledateformat.. and specify the correct date format you are using...
hope that helps -
Updating a Date Column in SP2010 using Javascript in WP
Hi,
I know that Today() doesn't work in SP. But seeing all the various JS codes to highlight rows etc is rather cumbersome, especially if you have several operations that you may want to run based on Today().
In my list, I have a column which is hidden from public view, 'thisDate'. This column is set to Date Only and with each new item that is added, it loads today's date. That's fine at item creation; but what I want to do is use JS to
update all fields in thisDate column with today's date whenever the list is first loaded on any new day.
<script type="text/javascript" language="javascript">
var tDate = null;
allItems = null;
ExecuteOrDelayUntilScriptLoaded(UpdateList, 'sp.js'); //this is necessary to ensure the library is loaded before function triggered
function DateThis(){
tDate = new Date().toJSON();
tDate.format("m/dd/yy");
return tDate;
function UpdateList(){
var tContext = new SP.ClientContext.get_current();
var tSite = tContext.get_site();
var tWeb = tSite.get_rootWeb();
var tList = tWeb.get_lists().getByTitle('TeamDUCOM LNO Travel');
var tQuery = SP.CamlQuery.createAllItemsQuery();
this.allItems = tList.getItems(tQuery);
tContext.load(allItems, 'Include(thisDate)');
tContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySuccess), Function.createDelegate(this, this.onQueryFailed));
function onQuerySuccess(){
var listEnum = allItems.getEnumerator();
var todaysDate = DateThis();
while(listEnum.moveNext()){
var currentItem = listEnum.get_current();
var origDate = currentItem.get_item('thisDate');
currentItem.set_item('thisDate',todaysDate);
currentItem.update();
tContext.executeQueryAsync(Function.createDelegate(this, this.ListItemsUpdateSuccess), Function.createDelegate(this, this.ListItemsUpdateFailed));
function onQueryFailed (){
alert('Query List Failed ');
function ListItemsUpdateSuccess(){
alert('Success ');
function ListItemsUpdateFailed(){
alert('Update List Failed ');
</script>
Right now, I get an 'onQueryFailed' alert saying the Query list failed. Also in the watch windo, I get null for 'tDate and 'todaysDate' is undefined.
Once I can get this to work, it is my intention to add an extra line or two to compare variables
origDate with todaysDate. If they match, skip and go to next. I think this would reduce updates and minimze the List sending out email alerts (most of my users use Alerts to be notified of changes to the list. (Bonus
would be being able to suspend any alert triggers at update, but I don't believe that's possible, or?)
After all the debugging, I also intend to comment out the alerts within the code, since no one needs to see that.
Ideally, this code would be reuseable on any list that needs countdowns, traffic lights, colorcoding etc, or even calcaulated columns using
thisDate data in lieu of the nonexistent Today()
function. And, as mentioned above, the list only needs to be updated once for the 1st person to open the list on any given day.
TIA
AH-CVictoria,
That didn't work for me. When I stripped out the script tags fro the file and placed it around the script url, I kept getting an error message within the webpart while in page edit view: "Cannot retrieve the URL specified in the Content Link
property. For more assistance, contact your site administrator."
I tried both your suggested change and the older script every which way - before the list, after the list, hidden and not. I then focused more on the IE 9's F12 developer tool and watched as it stepped thru the code. Everything was fine with the variables
(each object loaded in the Locals view) until it came time to call the executeQueryAsync.
I even traced down the stack and confirming the arguments. But a thot kept bugging me about "get_rootweb". i had seen other examples where it was "get_web" instead. When I went back to search Bing, I came across an example where the coder
just cut to the chase, bypassing varibles (in my case, dropping 'tSite' & 'tWeb'), so my trimmed code snippet now looks like this:
var tContext = SP.ClientContext.get_current();
var tList = tContext.get_web().get_lists().getByTitle('MyList Name');
var tQuery = SP.CamlQuery.createAllItemsQuery();
this.everyItem = tList.getItems(tQuery);
Prior to that, I also changed the var 'allItems', because I wondered if that was causing conflicts, case-sensitivity notwithstanding, since my default list view was 'AllItems.aspx'
Anyway, it now works regardless of CEWP positioning/hidden status (using only the reference to JS file in SiteAssets and using the script tags within the js file, not the CWEP link) -- typically, I make such CWEPs (ie EasyTabs) hidden and at the bottom of
the page, after the list and it works just fine.
I'm going to mark this thread as answered. But before I do that, I'll work out the one piece I need to add for the code to do nothing to a particular item if 'todaysDate' matches 'origDate' then post the entire code as the solution.
Thanks again.
Best regards,
AH-C
PS, I got a deluge of email alerts telling me that the list was updated. I anticipated that and will be looking for code to stop that if possible. But with the test for matching dates, at least I can limit the deluge of emails to once a day by whomever
is 1st to check the list that day (my alert is configured for instant alerting whenever a change has been made and I'd prefer to keep it that way, unless there's no workaround. -
Query To update a date column with a date of my interest
All,
How to update a column in a table which is in date format with a date of my interest??
Pls suggest.Please detail :
1. what exactly you are trying to do
2. what exactly you have done
Nicolas. -
Hello hello,
I just want to update a column with a specific date.
update table set date = ...
I almost tried everything. Also to_char and to-date and I always get the following error Message:
ORA-01747: invalid user.table.column, table.column, or column specification
The table and column names are correct. It must have something to do with the format of the date or the code itself is principle wrong.
regards philError: ORA-01747: invalid user.table.column, table.column, or columns specification
Cause: You tried to reference a column name, but the column name used is a reserved word in Oracle.
Solution:
1)Try redefining your table so that none of your column names are reserved words.
2)Try enclosing the reserved word in double quotes.
Since you have used reserved words in oracle as column names, you get these error messages.
Eg)
UPDATE suppliers
SET Integer = 10000;
the above should give you an error message 1747. The correct way is as below:
UPDATE suppliers
SET "Integer" = 10000; -
How to auto update date column without using trigger
Hi,
How to write below MYSQL query in Oracle 10g :
CREATE TABLE example_timestamp (
Id number(10) NOT NULL PRIMARY KEY,
Data VARCHAR(100),
Date_time TIMESTAMP DEFAULT current_timestamp on update current_timestamp
I need to auto update the Date_Time column without using trigger when ever i update a record.
Example shown below is from MYSQL. I want to perform the below steps in ORACLE to auto update Date_Time column.
mysql> INSERT INTO example_timestamp (data)
VALUES ('The time of creation is:');
mysql> SELECT * FROM example_timestamp;
| id | data | Date_Time |
| 1 | The time of creation is: | 2012-06-28 12:37:22 |
mysql> UPDATE example_timestamp
SET data='The current timestamp is: '
WHERE id=1;
mysql> SELECT * FROM example_timestamp;
| id | data | Date_Time |
| 1 | The current timestamp is: | 2012-06-28 12:38:55 |
Regards,
Yogesh.Is there no functionality in oracle to auto update date column without using trigger??
I dont want to update the date column in UPDATE statement.
The date column should automatically get updated when ever i execute an Update statement. -
hi guys i have 2 ? 1 my daughters iphone is trying to update on my mac cant get it off help please ,,, 2 i have an old apple id and when i try to up date it keeps looking for the password how do i delete this old apple id help
Hi.
I had a similar problem myself. This is what helped me.
I went to the App store app, scrolled to the bottom, logged out of the account, re logged in with my Apple ID. Then went back to app updates. Once I put in my ID password all was fine. -
has anyone else had a problem with data? after updating my phone to the new update, i have all this data, and keep getting notifications that my data is getting high. i never had this problem before.
fair enough. No need for any unnecessary posts either. You issue had been addressed ad nauseum already in this forum had you bothered to search this forum (as forum etiquette would dictate) before posting.
In any case, I hope that your problem was solved. -
ODP OracleCommandBuilder. Updating a table including DATE columns.
Hi
I have a problem with the OracleCommandBuilder not creating the correct update commands when I have DATE type columns in the table.
I have created a test table (called DATETEST) with three columns:
STRINGCOLUMN VARCHAR2 10
DATECOLUMN DATE
NUMBERCOLUMN NUMBER
The STRINGCOLUMN is the primary key.
Then I created a typed dataset that looks like this:
STRINGCOLUMN string
DATECOLUMN string
NUMBERCOLUMN long
This is the XML schema for the typed dataset:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="DateDS" targetNamespace="http://tempuri.org/DateDS.xsd" elementFormDefault="qualified" attributeFormDefault="qualified" xmlns="http://tempuri.org/DateDS.xsd" xmlns:mstns="http://tempuri.org/DateDS.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="DateDS" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="DATETEST">
<xs:complexType>
<xs:sequence>
<xs:element name="DATECOLUMN" type="xs:string" minOccurs="0" />
<xs:element name="STRINGCOLUMN" type="xs:string" minOccurs="0" />
<xs:element name="NUMBERCOLUMN" type="xs:long" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
And this is the test code:
Dim connection As Oracle.DataAccess.Client.OracleConnection
Dim adapter As New Oracle.DataAccess.Client.OracleDataAdapter()
Dim dbCommand As New Oracle.DataAccess.Client.OracleCommand()
Dim sqlstring As String
Dim data As New DateDS() 'Typed dataset
Const ConnectionString As String = "User Id=............."
Try
'Connect to database
connection = New OracleConnection(ConnectionString)
connection.Open()
'Get data from table DATETEST
dbCommand.CommandText = "SELECT STRINGCOLUMN, TO_CHAR(DATECOLUMN) AS DATECOLUMN, NUMBERCOLUMN FROM DATETEST"
dbCommand.Connection = connection
adapter.SelectCommand = dbCommand
adapter.Fill(data, "DATETEST")
'Make changes to dataset
data.DATETEST(0).DATECOLUMN = Now()
data.DATETEST(0).NUMBERCOLUMN = data.DATETEST(0).NUMBERCOLUMN + 1
'Update database
sqlstring = "SELECT * FROM DATETEST"
adapter.SelectCommand = New OracleCommand(sqlstring, connection)
Dim custCB As New Oracle.DataAccess.Client.OracleCommandBuilder()
custCB.DataAdapter = adapter
adapter.Update(data, "DATETEST")
'Disconnect
connection.Close()
connection.Dispose()
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
Getting the data from the database is not a problem.
The dataset contains the correct information.
But updating the database is impossible.
I get errors like:
ORA-01861: literal does not match format string
And if I don't specify a DATE format in the TO_CHAR statement I get this error:
Concurrency violation: the UpdateCommand affected 0 records.
I think I've tried everything.
I've used the OracleGlobalization class, with the SetSessionInfo method.
I've tried all different types of date conversions to make sure that
the date format on the database is the same as in the dataset.
I've tried to change the NLS parameters on the DB server and in the registry on the client.
I've tried to change the DATECOLUMN type in the typed dataset from string to Oracle.DataAccess.Types.OracleDate
But it still doesn't work.
The default date format on the DB 9i server is AMERICAN,(DD-MON-RR).
A strange thing is that when I instead of using the ODP classes use
the System.Data.OracleClient and its OracleCommandBuilder
the code works perfectly without any errors.
This is the test code that works:
Dim connection As System.Data.OracleClient.OracleConnection
Dim adapter As New System.Data.OracleClient.OracleDataAdapter()
Dim dbCommand As New System.Data.OracleClient.OracleCommand()
Dim data As New DateDS()
Dim sqlstring As String
Const ConnectionString As String = "User Id=......."
Try
'Connect to database
connection = New System.Data.OracleClient.OracleConnection(ConnectionString)
connection.Open()
'Get data from table DATETEST
dbCommand.CommandText = "SELECT STRINGCOLUMN, TO_CHAR(DATECOLUMN,'YYYY-MM-DD HH24:MI:SS') AS DATECOLUMN, NUMBERCOLUMN FROM DATETEST"
dbCommand.Connection = connection
adapter.SelectCommand = dbCommand
adapter.Fill(data, "DATETEST")
'Make changes to dataset
data.DATETEST(0).DATECOLUMN = Now()
data.DATETEST(0).NUMBERCOLUMN = data.DATETEST(0).NUMBERCOLUMN + 1
'Update database
sqlstring = "SELECT * FROM DATETEST"
adapter.SelectCommand = New System.Data.OracleClient.OracleCommand(sqlstring, connection)
Dim custCB As New System.Data.OracleClient.OracleCommandBuilder()
custCB.DataAdapter = adapter
adapter.Update(data, "DATETEST")
'Disconnect
connection.Close()
connection.Dispose()
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
My experience until this came up is that the ODP provider is better on everything
than the microsoft Oracle provider so I don't want to switch unless I have to.
Could someone that have used the ODP OracleCommandBuilder for updating a table including DATE columns with a typed dataset please give me some tips on how to make this work?
I would be the happiest man on earth if someone had a solution :-)
ErikDon't convert the dates to strings. Ever.
The command builder uses the metadata returned from the select command to build the insert/update commands. Using to_char in the query tells ODP that that is a varchar2 column. If you omit the to_char the commandBuilder will know to bind a date parameter in that spot.
Also in your typed dataset you should change the type from a string to a date.
David -
I can't get to update my apps it keeps on saying cannot connect to iTunes ... I changed the date and it didn't work still
The Complete Guide to Using the iTunes Store
http://www.ilounge.com/index.php/articles/comments/the-complete-guide-to-using-t he-itunes-store/
iTunes Store: Associating a device or computer to your Apple ID
http://support.apple.com/kb/ht4627
Can’t connect to the iTunes Store
http://support.apple.com/kb/TS1368
iTunes: Advanced iTunes Store troubleshooting
http://support.apple.com/kb/TS3297
Best Fixes for ‘Cannot Connect to iTunes Store’ Errors
http://ipadinsight.com/ipad-tips-tricks/best-fixes-for-cannot-connect-to-itunes- store-errors/
iOS: Changing the signed-in iTunes Store Apple ID account
http://support.apple.com/kb/ht1311
Try this - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.) No data/files will be erased. http://support.apple.com/kb/ht1430
This works for some users. Not sure why.
Go to Settings>General>Date and Time> Set Automatically>Off. Set the date ahead by about a year.Then see if you can connect to the store.
Cheers, Tom -
On deleting an item, "Name" column of recycle bin is updating with data in one of the custom column instead of title field in SP 2013 Custom list.
Thanks, ChinnuHi,
According to your post, my understanding is that you want to update title field in recycle bin with other field value of the item.
We can use the ItemDeleting Event Receiver to achieve it.
While item is deleting, replace title field value with other field value using ItemDeleting event receiver, then in the recycle bin, the title value will replace with other field value.
However, there is an issue while restore the item from the recycle bin, the item title would be replaced.
As an workaround, we can create a helper field in the list to store the title field value while deleting, then replace back while restoring using
ItemAdded Event Receiver.
I have made a simple code demo below to achieve this scenario, it works like a charm(the
Test2 field is the helper field, you can hide it in the list), you can refer to it.
public override void ItemDeleting(SPItemEventProperties properties)
properties.ListItem["Test2"]=properties.ListItem["Title"];
properties.ListItem["Title"]=properties.ListItem["Test1"];
properties.ListItem.Update();
base.ItemDeleting(properties);
/// <summary>
/// An item was added.
/// </summary>
public override void ItemAdded(SPItemEventProperties properties)
base.ItemAdded(properties);
properties.ListItem["Title"] = properties.ListItem["Test2"];
properties.ListItem.Update();
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support -
I have the IPhone 4s and it is up-to-date with all upgrades. Just recently I changed my YAHOO! password however each time I go into settings to update the password I keep getting "YAHOO! Server Unavailable Please try again later." I have lost my YAHOO! email connection, all calendar entries and saved notes.
A lot of people have been unable to access Yahoo e-mail on their iPhones or iPads. My wife’s iPad was not downloading Yahoo mail, although her iPhone was. Both used IOS 8.2. We tried deleting the account several times and troubleshooting all of the other settings. The problem appears to have been that allowing the IOS to automatically create the account on the iPad resulted in the wrong settings for the incoming server. The following procedure, pieced together from two websites, fixed the problem for us. So far, so good.
https://portal.smartertools.com/kb/a2659/configure-imap-for-iphone-or-ipad.aspx
https://help.yahoo.com/kb/mobile-mail/imap-server-settings-sln4075.html
On the iPhone, tap Settings.
Tap Mail, Contacts, Calendars.
Tap your Yahoo account, then delete it.
Tap Add Account.
Tap Other.
Tap Add Mail Account.
Complete the Name, Address (email address), Password and Description fields.
Click Next.
Ensure IMAP is selected.
Enter the following incoming mail server information:
Incoming Mail (IMAP) Server - Requires SSL
Server: imap.mail.yahoo.com
Port: 993
Requires SSL: Yes
Hostname is mail.yahoo.com.
Username is your full email address
Password is the same password used to access webmail.
Enter the following outgoing mail server information:
Outgoing Mail (SMTP) Server - Requires SSL
Server: smtp.mail.yahoo.com
Port: 465 or 587
Requires SSL: Yes
Requires authentication: Yes
Username is your full email address
Password is the same password used to access webmail. It may have been entered for you.
Tap Next.
The iPhone will establish an SSL connection to your IMAP and SMTP servers.
That’s all! -
Update XML data stored in CLOB Column
Hi All,
i am new to Oracle and new to SQL
i am trying to update XML data stored in CLOB cloumn,data is stored with the follwoing format
<attrs><attr name="name"><string>Schade</string></attr></attrs>
i am using the following query for updating the value
UPDATE PRODUCT p SET ATTRIBUTES_nl_nl=UPDATEXML(XMLTYPE.createXML(ATTRIBUTES_nl_nl),'/attrs/attr[@name="name"]/string/text()','Schade').getClobVal() WHERE p.sku='000000000000040576_200911-5010057'
this query is working fine but it changing the data to the following format
<attrs><attr name="name">Schade</attr></attrs>
some how it is ommiting the <string> tag from it, i am unable to figure it out whats the reason.
any help in this regard will b e much appriciated
Thanks in Advance
-UmeshHi,
You should have created your own thread for this, and included database version.
This works for me on 11.2.0.2 and 10.2.0.5 :
SQL> create table t_org ( xml_clob clob );
Table created
SQL>
SQL> insert into t_org
2 values(
3 '<Message>
4 <Entity>
5 <ASSIGNMENT>
6 <OAVendorLocation> </OAVendorLocation>
7 <Vendorid>1</Vendorid>
8 </ASSIGNMENT>
9 </Entity>
10 </Message>'
11 );
1 row inserted
SQL> commit;
Commit complete
SQL> select '*' ||
2 extractvalue(xmltype(xml_clob),'/Message/Entity/ASSIGNMENT/OAVendorLocation')
3 || '*' as result
4 from t_org;
RESULT
SQL> update t_org set xml_clob =
2 updatexml(xmltype(xml_clob),
3 '/Message/Entity/ASSIGNMENT/OAVendorLocation/text()','LONDON').getClobVal()
4 ;
1 row updated
SQL> select '*' ||
2 extractvalue(xmltype(xml_clob),'/Message/Entity/ASSIGNMENT/OAVendorLocation')
3 || '*' as result
4 from t_org;
RESULT
*LONDON*
Does the OAVendorLocation really have a whitespace value?
If not then it's expected behaviour, you're trying to update a text() node that doesn't exist. In this case, the solution is to use appendChildXML to create the text() node, or update the whole element.
Is it your real document? Do you actually have some namespaces? -
An import updates a date datatype column to sysdate
Hi
I couldn't find anything on this issue in the document.
I did an export of the data of table1 from database A, in table1 I have a column called CREATEDATE and it has a DATE datatype. When I imported it into database B, all rows now have the current SYSDATE in the CREATEDATE column instead of the original content as on db A.
Any clues why an import would treat a DATE column like that? and how I can maintain the original content on an import for a DATE type field???
I do not have a sysdate as the default value for the column.
Your help is appreciated!Sounds like you have a trigger firing. Triggers will fire during an import unless you disable them first. Try disabling all triggers on the tables being imported and see if that eliminates the problem.
Maybe you are looking for
-
Sending an email, containing an adobe interactive form, as a step in a gp
I'm trying to create a process in gp. the first step is an interactive form that is submitted to netweaver and starts the gp process. second should be another interactive form that the system sends out to an email account. wstarting the process by in
-
osx 10.7.4 safari 6.0 When I add a new bookmark to the "bookmarks menu" it is added somewhere in the middle instead of at the end of the list. This just started a few days ago after an update. Has anyone else noticed this?.
-
How to sync folder on Macbook pro with external portable drive
Hello, I am new to mac environment. I would like to sync up my itunes library from my PC to Macbook Pro. I currently backup my itunes on PC using synctoy 2.1 to portable drive. I am able to copy folders from portable drive onto macbook pro but wou
-
In DeskI, what's the maximum for "Limit size of long text objects"? 2000?
In Universe Designer, we have a setting which is "Limit size of long text objects", it can control how many characters can be displayed for long text objects. The problem is that in DeskI, we can only display 2000 characters even we set 2500 or more
-
Hello, I need to create a smartform with the following behaviour: When the page shown is the last one, the main window has to take half page. On the other hand, when the page shown is not the last one, its main window has to take almost the whole pag