How to get SQL to read numbers as a date?

Hi
I have a database of orders. Each order has sub orders with date information, but in separate columns: day, month and year.
E.g. a sub order will have day = 1, month = 10, year = 2007 each in a different column
I want SQL to be able to concatenate the three columns into a date and then be able to select the 'min' of the dates.
Eventually I will group sub orders together into orders and want each order to also show the earliest sub order date.
Is there anyway I can do this? I'm not very experienced with SQL but it seems like it should be possible.
Thanks any help greatly appreciated.

This is an Oracle SQL forum, it doesn't cover other flavors of SQL like MySQL, MS SQL etc. The function TO_DATE is an Oracle SQL function so if it doesn't exist then you must be using some other kind of SQL.

Similar Messages

  • How to get the most current file based on date and time stamp using SSIS?

    Hello,
    Let us assume that files get copied in a specific directory. We need to pick up a file and load data. Can you guys let me know how to get the most current file based on date and time stamp using SSIS?
    Thanks
    thx regards dinesh vv

    hi simon
    i excuted this script it is giving error..
       Microsoft SQL Server Integration Services Script Task
       Write scripts using Microsoft Visual C# 2008.
       The ScriptMain is the entry point class of the script.
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    namespace ST_9a6d985a04b249c2addd766b58fee890.csproj
        [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
        public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
            #region VSTA generated code
            enum ScriptResults
                Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
                Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
            #endregion
            The execution engine calls this method when the task executes.
            To access the object model, use the Dts property. Connections, variables, events,
            and logging features are available as members of the Dts property as shown in the following examples.
            To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
            To post a log entry, call Dts.Log("This is my log text", 999, null);
            To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
            To use the connections collection use something like the following:
            ConnectionManager cm = Dts.Connections.Add("OLEDB");
            cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
            Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
            To open Help, press F1.
            public void Main()
                string file = Dts.Variables["User::FolderName"].Value.ToString();
                string[] files = System.IO.Directory.GetFiles(Dts.Variables["User::FolderName"].Value.ToString());
                System.IO.FileInfo finf;
                DateTime currentDate = new DateTime();
                string lastFile = string.Empty;
                foreach (string f in files)
                    finf = new System.IO.FileInfo(f);
                    if (finf.CreationTime >= currentDate)
                        currentDate = finf.CreationTime;
                        lastFile = f;
                Dts.Variables["User::LastFile"].Value = lastFile;
                Dts.TaskResult = (int)ScriptResults.Success;
    thx regards dinesh vv

  • Af:query : How to get sql

    Hi,
    How can i get SQL Query that is executing when I enter some criteria and click on Search button of query panel?
    I tried to override executeQuery() method of VOImpl and printed getQuery(). It is showing the query with bind variable in the query and vc_temp for the fields that are added in Advance mode.
    I want to get the actual query that is getting executed.
    Regards,
    Vino

    Can anyone help?

  • How to get rid of  Reading List and why my add page going in there?

    My + on the toolbar is now adding pages to the reading list instead of the bookmark.. How do i change that/get rid off reading list? I want stuff to go to bookmark. I tried to change the setting in  in Safari>Preferences>Bookmark but I dont have a bookmark option.. Very annoying. I updated to 10.9.1 version. Help!

    Click and hold the button to add a bookmark.

  • How to get rid of the numbers on the Pages flag icon

    How do I get rid of the numbers tag at the top of the Pages Flag in iWork

    Lola
    Got your email and couldn't clearly see what you were talking about because you reduced the resolution on a busy background. So I went to the iTunes Store to find if there was something similar.
    That is the Facebook Pages Manager, and is telling you you have notifications pending in Facebook.
    The Pages refers to the "pages" (different views) of content in Facebook, nothing to do with Apple's Pages.
    Peter

  • How to get sql server performance counters using query?

    Hai i want to see my sql server performance counters like, Full Scans/sec,  Buffer
    Cache Hit Ratio,  Database Transactions/sec, User
    Connections, Average Latch Wait Time (ms), Lock
    Waits/sec, Lock Timeouts/sec, Number
    of Deadlocks/sec, Total Server Memory, SQL
    Re-Compilations/sec, User Settable Query. If any one know how to get it by using query means, please help me.
    Thanks in advance

    Hello,
    Below is query created by Jonathan Kehayias for measuring Perfom counters using DMV sys.dm_os_performance_counter.
    You can download book from below link
    https://www.simple-talk.com/books/sql-books/troubleshooting-sql-server-a-guide-for-the-accidental-dba/
    DECLARE @CounterPrefix NVARCHAR(30)
    SET @CounterPrefix = CASE WHEN @@SERVICENAME = 'MSSQLSERVER'
    THEN 'SQLServer:'
    ELSE 'MSSQL$' + @@SERVICENAME + ':'
    END ;
    -- Capture the first counter set
    SELECT CAST(1 AS INT) AS collection_instance ,
    [OBJECT_NAME] ,
    counter_name ,
    instance_name ,
    cntr_value ,
    cntr_type ,
    CURRENT_TIMESTAMP AS collection_time
    INTO #perf_counters_init
    FROM sys.dm_os_performance_counters
    WHERE ( OBJECT_NAME = @CounterPrefix + 'Access Methods'
    AND counter_name = 'Full Scans/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Access Methods'
    AND counter_name = 'Index Searches/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Buffer Manager'
    AND counter_name = 'Lazy Writes/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Buffer Manager'
    AND counter_name = 'Page life expectancy'
    OR ( OBJECT_NAME = @CounterPrefix + 'General Statistics'
    AND counter_name = 'Processes Blocked'
    OR ( OBJECT_NAME = @CounterPrefix + 'General Statistics'
    AND counter_name = 'User Connections'
    OR ( OBJECT_NAME = @CounterPrefix + 'Locks'
    AND counter_name = 'Lock Waits/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Locks'
    AND counter_name = 'Lock Wait Time (ms)'
    OR ( OBJECT_NAME = @CounterPrefix + 'SQL Statistics'
    AND counter_name = 'SQL Re-Compilations/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Memory Manager'
    AND counter_name = 'Memory Grants Pending'
    OR ( OBJECT_NAME = @CounterPrefix + 'SQL Statistics'
    AND counter_name = 'Batch Requests/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'SQL Statistics'
    AND counter_name = 'SQL Compilations/sec'
    -- Wait on Second between data collection
    WAITFOR DELAY '00:00:01'
    -- Capture the second counter set
    SELECT CAST(2 AS INT) AS collection_instance ,
    OBJECT_NAME ,
    counter_name ,
    instance_name ,
    cntr_value ,
    cntr_type ,
    CURRENT_TIMESTAMP AS collection_time
    INTO #perf_counters_second
    FROM sys.dm_os_performance_counters
    WHERE ( OBJECT_NAME = @CounterPrefix + 'Access Methods'
    AND counter_name = 'Full Scans/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Access Methods'
    AND counter_name = 'Index Searches/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Buffer Manager'
    AND counter_name = 'Lazy Writes/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Buffer Manager'
    AND counter_name = 'Page life expectancy'
    OR ( OBJECT_NAME = @CounterPrefix + 'General Statistics'
    AND counter_name = 'Processes Blocked'
    OR ( OBJECT_NAME = @CounterPrefix + 'General Statistics'
    AND counter_name = 'User Connections'
    OR ( OBJECT_NAME = @CounterPrefix + 'Locks'
    AND counter_name = 'Lock Waits/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Locks'
    AND counter_name = 'Lock Wait Time (ms)'
    OR ( OBJECT_NAME = @CounterPrefix + 'SQL Statistics'
    AND counter_name = 'SQL Re-Compilations/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'Memory Manager'
    AND counter_name = 'Memory Grants Pending'
    OR ( OBJECT_NAME = @CounterPrefix + 'SQL Statistics'
    AND counter_name = 'Batch Requests/sec'
    OR ( OBJECT_NAME = @CounterPrefix + 'SQL Statistics'
    AND counter_name = 'SQL Compilations/sec'
    -- Calculate the cumulative counter values
    SELECT i.OBJECT_NAME ,
    i.counter_name ,
    i.instance_name ,
    CASE WHEN i.cntr_type = 272696576
    THEN s.cntr_value - i.cntr_value
    WHEN i.cntr_type = 65792 THEN s.cntr_value
    END AS cntr_value
    FROM #perf_counters_init AS i
    JOIN #perf_counters_second AS s
    ON i.collection_instance + 1 = s.collection_instance
    AND i.OBJECT_NAME = s.OBJECT_NAME
    AND i.counter_name = s.counter_name
    AND i.instance_name = s.instance_name
    ORDER BY OBJECT_NAME
    -- Cleanup tables
    DROP TABLE #perf_counters_init
    DROP TABLE #perf_counters_second
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • How to get .msi from Reader .exe v11.0.01 for domain update

    Wondering how to get the .msi file that I need to patch the domain workstations using Windows Group Policy.  The only file Adobe provides is an .exe file for the latest update. v11.0.01

    As an alternative to what Baigley has suggested, you can use the 11.0.00 MSI as released by Adobe and patch it using the latest 11.0.01 patch to create a GPO package to be deployed across your network as below.
    1. Download the 11.0.00 MSI from ftp://ftp.adobe.com/pub/adobe/reader/win/11.x/11.0.00/en_US/AdbeRdr11000_en_US.msi
    2. Download the 11.0.01 MSP from http://ardownload.adobe.com/pub/adobe/reader/win/11.x/11.0.01/misc/AdbeRdrUpd11001.msp
    3. Create an AIP using the MSI downloaded in step 1 above by the following command:
        msiexec /a <path to MSI downloaded>
        In the subsequent dialogs provide a location wherein to create the AIP (for instance C:\AIP)
    4. Once the AIP is created, patch it with the latest 11.0.01 installer by the below command.
        msiexec /a C:\AIP\AdbeRdr11000_en_US.msi /p <path to MSP downloaded in Step 2>
    This will create the GPO Package for 11.0.01 Reader, ready to be deployed in your network.
    Hope this helps.
    Thanks
    Ankit

  • How to get app to read my kindle books

    I need assistance and getting my Adobe Reader to read books that I have downloaded and they are you books fromso how do you do this thank you

    Adobe Reader does not read Kindle format books. It will read PDF documents, however.
    To read Kindle books you need the Kindle app from Amazon.

  • How to get motion to read text from file?

    There has to be a way to do this. I have a large file of text (transcripts from a clip several minutes long) and I want to make subtitles using Motion.
    How can I get Motion to read the file and create a text object with the sentence/line in the file, then move to the next one and do the same thing for the next line? Thus it would make a timeline with several objects of individual sentences of text. Anyone have some ideas how to do this?
    Thanks.

    I was just playing around, and I think I figured out how to get what you want.  First, change the layout method for the generator to "Paragraph", you can find this in the layout section of the generator. In your document, use carraige returns (return key) to define each section of text.  To control the speed that each line appears, change the speed setting to custom, and then adjust the end keyframe.

  • Does any one know EXACTLY how to get siri to READ text messages out loud ?

    How do I get siri to READ my text messages ? What do I "say " to siri ?

    Just reading through this post and the best way to Reset SIRI is to go to Settings>General>Siri and then turn SIRI off. This erase's anything SIRI has learn't about you, all you have to do then is turn SIRI back on and it is reset. It is not necessary to reset the iPhone itself.
    SIRI can only read back unread Txt messages, if you have opened a Txt message and already read it you can not have SIRI read it back to you. Don't forget SIRI is still in BETA and will take a little while while Apple tweek this technology.
    Cheers.

  • How to get correct voltage reading?

    Currently I am using PCL-818 DAS card from Advantech. Advantech's test program shows value correctly and I compare it with the multimeter. Problem is that I cannot get them correctly. For eg. The actual reads 5V but the indicator on front panel reads 0.09V instead. I used Advantech's AIVoltageIn.vi. What are the right adjustments I should apply on the Numeric Indicator's properties?

    astroboy wrote:
    > Currently I am using PCL-818 DAS card from Advantech. Advantech's test
    > program shows value correctly and I compare it with the multimeter.
    > Problem is that I cannot get them correctly. For eg. The actual reads
    > 5V but the indicator on front panel reads 0.09V instead. I used
    > Advantech's AIVoltageIn.vi. What are the right adjustments I should
    > apply on the Numeric Indicator's properties?
    I had to deal once with an Advantech card and I think you had to first
    configure it for a certain input range, which depends on the card you
    are using, or maybe jumbers on it :-(. Your problem looks very much like
    the card is configured to read for instance 0 - 10 V but the software
    believes the card is set to -5 - +5 V.
    Of course the configuration param
    eter on that VI was just a number 0, 1,
    2, 3, 4, etc so it was not very user friendly and in that particular
    case I just played around a bit until I got the correct measurements.
    I told however the guy asking me to show him how to get the card
    running, that I didn't very much like this driver and that I feel a LOT
    more comfortable to program with NI-DAQ than this quite user unfriendly
    library. Not sure if he did buy his next card from NI though.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to get SQL server IP ?

    Hi ALL ,
    I am using this script to get the SQL server IP address but it is working on one of the servers and generating an error on the other 
    SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS') [Machine Name]
       ,SERVERPROPERTY('InstanceName') AS [Instance Name]
       ,LOCAL_NET_ADDRESS AS [IP Address Of SQL Server]
       ,CLIENT_NET_ADDRESS AS [IP Address Of Client]
     FROM SYS.DM_EXEC_CONNECTIONS
     WHERE SESSION_ID = @@SPID
    there error I am getting is 
    Invalid object name 'SYS.DM_EXEC_CONNECTIONS'.
    Any ideas how to get it to work ?

    Do you have
    VIEW SERVER STATE permission?
    Can you execute below SQL and post us the output?
    SELECT HAS_PERMS_BY_NAME(null, null, 'VIEW SERVER STATE');
    Also, Can you check the existence of the DMV under master database -> views->system views of the server?
    --Prashanth

  • How to get the right format if I copy data off another source....

    IWorks '08
    I have a data source that I want to copy to Numbers and it posts it all in the first row, when I paste it. (Excel will automatically format it correctly). I've tried a number of different things and can't figure out how to get the data to post across the page. Can Numbers even do this?

    Welcome to Apple Discussions
    Could you possibly have the insertion cursor blinking in the cell rather than just having a cell selected?
    If the cursor is blinking in the cell, Numbers "thinks" you want to paste all of the content in that one cell. By just selecting the cell, the data will be separated if Numbers "sees" the separations. This used to be a problem, particularly with data copied from a web page in Safari, but is mostly fixed in Numbers '09.

  • How to get the opening balances for lessthan selected date in cubes.

    Hi All,
    my task is to get the opening balances for the selected date.
    Ex: If I select date say 31-1-2013, I should get the sum of values which are less than the selected date.
    in sql:
    select sum(balance) from banktrans where banktrans.transdate < 31-1-2013;
    BankTable                            BankTrans
    BankId                               BankId
                                            balance
                                            transdate
    BankTable (records):
    SCB
    BankTrans(records):
    a) SCB, 15000, 10-02-2013
    b) SCB, 20000, 31-01-2014
    c) SCB, 50000, 21-09-2012
    If I select date as 31-01-2014, I should get the value as 65000 
    If I select date as 10-02-2013, I should get the value as 50000
    Date will be dynamic selection from years months days hirearchy ( time dimension)
    How can i achieve this?  
    any help is much appreciated.
    Thanks,
    Rakesh

    Dear David,
    I've tried the below with static date but i'm not getting the values which are sum of less than the given date.
    I've given 1st jan 2013 as static date and I need to get the sum of values which are less than the 1st jan date.
    CREATE
    MEMBER
    CURRENTCUBE.[Measures].[OPENBALANCE]
    AS
    Sum({Null:[Time].[Years
    Quarters Months Weeks Days].[Days].&[2013-01-01T00:00:00]},[Measures].[AmountCur]]),
    FORMAT_STRING
    = "Standard",
    VISIBLE
    = 1
    can you plz check the above once and guide me.
    Thankyou,
    Rakesh

  • How to get open items as on a key date

    Hi experts,
    I want to show a report Agewise report of offsets: 0-30, 30-60,....
    Only the open items of Vendor as on a particular key date to be considered...
    How to get the open items as on a particular key date ?
    Regards,
    Rao.

    Hi All,
    Thanks for the reply..
    ==============================================================
    Basically create one ckf and two rkfs for each aging bucket
    ie ckf 0-30 days = rkf 0-30 days open + rkf 0-30 days subsequently cleared
    Because you need to restate the AP report to a key date - some items have changed their status since that key date but were open at the key date (ie we call those subsequently cleared)
    so rkf 0-30 days open is
    posting date <= key date
    item status = O
    net due date between variable date (cmod which reads key date) offset 0 and variable date (cmod which reads key date) offset -30
    rkf 0-30 days subsequently cleared is
    posting date <= key date
    cleared date > variable date (which reads cmod of key date)
    net due date between variable date (cmod which reads key date) offset 0 and variable date (cmod which reads key date) offset -30
    ========================================================================
    In the above two cases, while creating restricted key figures how to design this;
    net due date between variable date (cmod which reads key date) offset 0 and variable date (cmod which reads key date) offset -30
    And also after creation of two rkfs i created a ckf i.e ckf = rkf1+rkf2.
    Now i dragged this ckf into columns and when i checked the query it is giving error that key date variable is used more than once. ( Bcz we have used key date variable both in rkf1 and rkf2 for getting posting date <= to key date )
    What is the solution for this ?
    Regards,
    Rao.

Maybe you are looking for

  • FX 5200 T-128 problem

    I recently bought a nVIDIA GeForce FX5200 T-128 card, which claims to support dual link DVI on the manual, but how is that remotely possible when there is only one physical connector on the card, which happens to be analogue??????????????? Please hel

  • Audigy 4-Need help finding EAX softw

    I am unable to locate the software cd that came with my card. Does someone know where i can find that software, EAX console, surround sound setup, ect. Please help this is driving me insane. Downloaded one from downloads.com but setup said it was una

  • How to generate org model through report

    How to generate org model using report . please share your information . thanks in advance , sapcrm

  • Path to Executable from Dynamicall​y called VIs

    QUESTION: How can I retrieve the path to an executable that is called from a VI that was created by dynamically loading a VI template? The application is a bit too complicated to post, so I will try to describe... I have a built executable. It dynami

  • Set Non-Scrolling Region in RH HTML

    I am using RH 8 for HTML. In RH Word I could set a non-scrolling region in my individual topics. Is there a way to do that in HTMLHelp? Thanks!