Query to get the current DB date, not server date

Hi,
We have few DB in one server, but each DB have different timezone.
How can I get the query to generate the current date in each DB?
Thanks

Hi,
Try this query:
SELECT DB_NAME() AS DataBaseName,getdate()
Thanks & Regards,
Nagarajan

Similar Messages

  • SQL query to get the current session info

    I've a query in my application to view the all the sessions within database
    select
    substr(a.spid,1,9) pid,
    substr(b.sid,1,5) sid,
    substr(b.serial#,1,5) ser#,
    substr(b.machine,1,6) box,
    substr(b.username,1,10) username,
    -- b.server,
    substr(b.osuser,1,8) os_user,
    substr(b.program,1,30) program
    from
    v$session b,
    v$process a
    where
    b.paddr = a.addr
    and type='USER'
    order by spid;
    Can someone help me with a query to view the info of the session where I'm in currently?
    Thanks,
    Gabriel Stephen.

    here's one way to do it.
    select
       substr(a.spid,1,9) pid,
       substr(b.sid,1,5) sid,
       substr(b.serial#,1,5) ser#,
       substr(b.machine,1,6) box,
       substr(b.username,1,10) username,
       -- b.server,
       substr(b.osuser,1,8) os_user,
       substr(b.program,1,30) program
    from
       v$session b,
       v$process a
    where
       b.paddr = a.addr
       and type='USER'
       and b.sid=(select sid from v$mystat where rownum=1)
    order by spid-------------
    Anwar

  • Write a query to get the users those are not appliyed for the exam?

    hi frz i have two tables like User,UserHistory
    User table contains clmns--Uid,Uname
    UserHistory contain columns--Uid,Course,Status.
    so i want to write a query to find out those are not applied for the particlur course i want to found only those records from the two tables...

    Hello,
    The SQL Server forums are over here:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/home
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • Query to get the data of all the columns in a table except any one column

    Can anyone please tell how to write a query to get the data of all the columns in a table except one particular column..
    For Example:
    Let us consider the EMP table.,
    From this table except the column comm all the remaining columns of the table should be listed
    For this we can write a query like this..
    Select empno, ename, job, mgr, sal, hiredate, deptno from emp;
    Just to avoid only one column, I mentioned all the remaining ( 7 ) columns of the table in the query..
    As the EMP table consists only 8 columns, it doesn't seem much difficult to mention all the columns in the query,
    but if a table have 100 columns in the table, then do we have to mention all the columns in the query..?
    Is there any other way of writing the query to get the required result..?
    Thanks..

    Your best best it to just list all the columns. Any other method will just cause more headaches and complicated code.
    If you really need to list all the columns for a table because you don't want to type them, just use something like...
    SQL> ed
    Wrote file afiedt.buf
      1  select trim(',' from sys_connect_by_path(column_name,',')) as columns
      2  from (select column_name, row_number() over (order by column_id) as column_id
      3        from user_tab_cols
      4        where column_name not in ('COMM')
      5        and   table_name = 'EMP'
      6       )
      7  where connect_by_isleaf = 1
      8  connect by column_id = prior column_id + 1
      9* start with column_id = 1
    SQL> /
    COLUMNS
    EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,DEPTNO
    SQL>

  • Get the current date

    How does one get the current date?

    I would not use the date object (mostly deprecated), instead use the Calendar object.
    See...
    http://java.sun.com/j2se/1.3/docs/api/index.html

  • GregorianCalendar - getting the current date

    Hi,
    Have any of the Calendar classes been changed in version 1.5. I'm trying to get the current date and time in an application, to add to filenames when they are backed up. In java 1.4 the following code was sufficient to get the information required:
    GregorianCalendar cal = new GregorianCalendar();
    filename = "C:\\Program Files\\Apache Group\\Apache2\\www\\test\\htdocs\\backups\\";
    filename += theFile;
    filename += "=" + getUser() + "=" + cal.get( Calendar.HOUR_OF_DAY ) + "_" +
         cal.get( Calendar.MINUTE ) + "=" + cal.get( Calendar.DAY_OF_MONTH ) + "_" +
         ( cal.get( Calendar.MONTH ) + 1 ) + "_" + cal.get( Calendar.YEAR );
    I'm writing another app using the same code and SDK 1.5, but it's returning the same values every time.
    Cheers
    Matt

    I wrote a small program to test the Calendar object on my system:
    import java.util.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Tester extends Frame implements ActionListener
         public Tester()
              javax.swing.Timer timer = new javax.swing.Timer( 1000, this );
              timer.start();
              setSize( 400, 400 );
              show();
              addWindowListener(
                   new WindowAdapter()
                        public void windowClosing( WindowEvent e )
                             System.exit( 0 );
         public void actionPerformed( ActionEvent e )
              Calendar cal = new GregorianCalendar();
              System.out.println( "Time: " + cal.HOUR + ":" + cal.MINUTE + ":" + cal.SECOND );
         public static void main( String args[] )
              Tester t = new Tester();
    This repeatedly outputs:
    10:12:13
    I tried this with Calendar and GregorianCalendar. Both of them do not seem to work. I'm not using the same Calendar object, or outputing in the same second....

  • Get the Current Date and Time of a Location

    I have created a windowsPhoneApplication in silverLight 8.1.In my application,I have to upload videos on some server.The Uploading get failed If the Date and Time settings of my device is not the current Date and Time.So How can I get the current date
    and time even if the device settings is wrong?

    Hi shifana,
    Do you know server's time zone? If yes, you can manually translate to the correct time zone.
    Otherwise try some online time acquire API.
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to get the current Date

    With the following piece of code, I am able to get the current date in bpe forms, but not when I put it in any of the forms logged in using end user(not even in end user menu).
    <Field name='request.submitDate'>
    <Display class='Label'>
    <Property name='value'>
    <invoke name='dateToString' class='com.waveset.util.Util'>
    <ref>java.util.Date</ref>
    </invoke>
    </Property>
    </Display>
    </Field>
    The following error is getting displayed in the end user menu form.
    XPRESS exception:
    Can't call method dateToString on class com.waveset.util.Util ==> java.lang.NullPointerException: -------can anyone please help me out
    or can anyone suggest a way for getting the current date
    Regards
    Gajendra Nagapurkar

    The <ref> tag is used to refer to the value of some variable. The value of the variable java.util.Date in your example is NULL, because it doesn't exist!
    If you remove that argument from your <invoke>, the call resolves to the method com.waveset.util.Util.dateToString() and will return something like "20050810 11:00:21".

  • How do I get bookmarks on the toolbar to open in the current tab, and not open in a new tab?

    how do I get bookmarks on the toolbar to open in the current tab, and not open in a new tab?

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • When backing up on time machine is get " The back up disk image'/volume/data/eric balnchard's Macbook.sparbundle"could not be accessed (error-1). what does it mean? it's a new time machine

    when backing up on time machine is get " The back up disk image'/volume/data/eric balnchard's Macbook.sparbundle"could not be accessed (error-1). what does it mean? it's a new time machine

    Expect to see this error again due to a bug in Lion (and Mountain Lion).
    See # C17 in Pondini's excellent support document below, or look over to the right of this web page under the heading of More Like This
    http://pondini.org/TM/Troubleshooting.html

  • HT1338 my mac is running 10.5.8, I bought a new Nano, itunes is prompting me to get the current itunes, but my mac will not take it, states I need 10.6.8.  How do I get that?  When I run a software update, system says there is none.  Help

    my mac is running 10.5.8, I bought a new Nano, itunes is prompting me to get the current itunes, but my mac will not take it, states I need 10.6.8.  How do I get that?  When I run a software update, system says there is none.  Help

    Click here, check that your computer meets the requirements, buy and install the DVD, and then run Software Update.
    (73181)

  • How to get the "current date" in the BEx?

    Hi all,
    I need to get the "current date" in my Bex report in order to make a comparison. I know there is a "How to" which shows how to get the current date via a User Exit, but I didn't find it. Could you please help me?
    Thanks

    1. Create a  New Formula in Key Figures structure
    2. Give tech name and description and Select "New variable" option
    3. Next screen will launch Variable Wizard -> create a new variable with replacement path as processing type
    4. in next screene  select the date characteristic that represents the first date to use in the calculation (From Date)
    5. In the next  screen select Key in the Replace Variable with field. Leave all the other options as they are
    6. In the next Currencies and Units screen select Date as the Dimension ID.
    6. Save variable
    repeate the Above steps to create another variable (To Date)
    and now you can use these two new replacement path variables in your new formula.
    Dev

  • How to get the current date in a workflow

    Hey,
    Can anyone tell me how to get the current date while in a workflow?
    Thanks in advance.

    Here is how we did it, hope it helps
    <defvar name='locCalendar'>
    <new class='java.util.GregorianCalendar'/>
    </defvar>
    <defvar name='dateFormat'>
    <new class='java.text.SimpleDateFormat'>
              <s>MM/dd/yyyy</s>
         </new>
    </defvar>
    <defvar name='formatedDate'>
         <invoke name='getTime'>
    <ref>locCalendar</ref>
    </invoke>
    </defvar>
    <invoke name='format'>
    <ref>dateFormat</ref>
    <ref>formatedDate</ref>
    </invoke>

  • How to get the current date ? in the form of dd/mm/yyyy?

    Hi all,
    As getDate( ), getMonth( ), and getYear( ) is depricated, how to get the current date or System date, month and year ? please help ??
    Regards
    Ashvini

    HI,
    Than u for the reply. But i am getting one error.
    as u said, I tried to do so.........
    but, i am getting one error.
    code
    Calendar cald=(Calendar.getInstance.getTime());
    out.println(cald);
    error message
    validate$jsp.java:86: Attempt to reference method getInstance in class java.util.Calendar as an instance variable.
    Calendar cald=(Calendar.getInstance.getTime());
    ^
    1 error
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:284)
    Pls help
    Regards,
    Ashvini

  • How to get the current date and compare dates

    hi
    does anyone know how you would get the current date?
    furthermore, how to compare the current date with a past date to see how many days or months have past since then?
    thanks

    have a look at the Date class. new Date() creates an object containing the exact date and time at creation time. (Date).getTime() might be useful for comparing two dates. GregorianCalendar might be useful, too.

Maybe you are looking for

  • Laserjet 1160 and Vista

    Hello! My mum has an HP Laserjet 1160. She has been using the printer with no problems with her PC that was on Windows XP. Last week she purchased a new PC. The new PC is on Vista. We have hooked up the Laserjet to the new PC. When I look at the Cont

  • To Run the Costing for Previous period

    Dear Firends, I need some help for costing run for Pervious period. In my sap system Current period is 04-2009. But i want to run costing RUN upto 03-2009 (Previous Period ) because i have some pending documents is there for 04-2009 period. So we pla

  • Can my Wife and I have separate 'My Top Rated' Smart Playlists using the Same iTunes Match Library?

    My wife and I would like to have separate 'My Top Rated' Smart Playlists in iTunes Match. We use the same library, and this seems to be the glitch. I've heard that you can configure this type of thing, but how?

  • Itunes in other countries.... HELPPP!!!!

    Hi. I am from Mexico and i wanted to know if someone knows if the itunes music store works in my country. well.... if someone knows.... please hELP ME!!!!!

  • Where is an opacity/scale/speed LINE on CC?

    I have got Adobe After Effects CC from few minutes. And I noticed that line for keyfreming is missing. How can I see a timeline of for example OPACITY? It's gone in CC version.