GregorianCalendar datetime format convert to  sql server date time format

please help me
my GregorianCalendar date time format is like this. *08/01/29 02:25:59* . I try to insert my database(sql server 2000 )
data type is datetime ,in my database table display like this *2029-08-01 02:25:59.000* .can you help me to insert correct date in my database table like ( . *08/01/29 02:25:59*)

use [PreparedStatement |http://java.sun.com/javase/6/docs/api/java/sql/PreparedStatement.html] and setTimestamp:
[http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html]

Similar Messages

  • How to convert MS SQL Server data to XML data using Java

    Hi all!
    How do I generate XML document for SQL Server data using java / jsp.
    Thanks in advance

    http://www.fdsapi.com

  • SQL Server date format

    Hi all,
    I realize that this may be a little bit out of the scope of this forum, but I thought I'd ask anyway.
    I'm trying to figure out how to select a date in the format mm/dd/yyyy from a SQL Server date/time field. I've browsed the internet on this but haven't found any quick/easy way to do this. Can anyone please help me out here?
    Thanks!
    -Stephen Spalding
    Web Developer
    Graybar

    Hi Stephen,
    You can use the convert function in sql to change the format of the date time field.
    select convert(varchar(13),getdate(),101) gives u the current date in mm/dd/yyyy format.
    If you want that in java you can use the SimpleDateFormat class to change the format.
    import java.text.Format;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    Date currentDate = null;
    Format formatter = null;
    String date = "";
    currentDate = new Date();
    formatter = new SimpleDateFormat("MM/dd/yyyy");
    date = formatter.format(currentDate);
    This should give in the mm/dd/yyyy format.
    But both the results will be in String Format and not datetime.
    Hope this will be useful to you.
    Regards
    Prakash

  • How to convert from SQL Server table to Flat file (txt file)

    I need To ask question how convert from SQL Server table to Flat file txt file

    Hi
    1. Import/Export wizened
    2. Bcp utility
    3. SSIS 
    1.Import/Export Wizard
    First and very manual technique is the import wizard.  This is great for ad-hoc and just to slam it in tasks.
    In SSMS right click the database you want to import into.  Scroll to Tasks and select Import Data…
    For the data source we want out zips.txt file.  Browse for it and select it.  You should notice the wizard tries to fill in the blanks for you.  One key thing here with this file I picked is there are “ “ qualifiers.  So we need to make
    sure we add “ into the text qualifier field.   The wizard will not do this for you.
    Go through the remaining pages to view everything.  No further changes should be needed though
    Hit next after checking the pages out and select your destination.  This in our case will be DBA.dbo.zips.
    Following the destination step, go into the edit mappings section to ensure we look good on the types and counts.
    Hit next and then finish.  Once completed you will see the count of rows transferred and the success or failure rate
    Import wizard completed and you have the data!
    bcp utility
    Method two is bcp with a format file http://msdn.microsoft.com/en-us/library/ms162802.aspx
    This is probably going to win for speed on most occasions but is limited to the formatting of the file being imported.  For this file it actually works well with a small format file to show the contents and mappings to SQL Server.
    To create a format file all we really need is the type and the count of columns for the most basic files.  In our case the qualifier makes it a bit difficult but there is a trick to ignoring them.  The trick is to basically throw a field into the
    format file that will reference it but basically ignore it in the import process.
    Given that our format file in this case would appear like this
    9.0
    9
    1 SQLCHAR 0 0 """ 0 dummy1 ""
    2 SQLCHAR 0 50 "","" 1 Field1 ""
    3 SQLCHAR 0 50 "","" 2 Field2 ""
    4 SQLCHAR 0 50 "","" 3 Field3 ""
    5 SQLCHAR 0 50 ""," 4 Field4 ""
    6 SQLCHAR 0 50 "," 5 Field5 ""
    7 SQLCHAR 0 50 "," 6 Field6 ""
    8 SQLCHAR 0 50 "," 7 Field7 ""
    9 SQLCHAR 0 50 "n" 8 Field8 ""
    The bcp call would be as follows
    C:Program FilesMicrosoft SQL Server90ToolsBinn>bcp DBA..zips in “C:zips.txt” -f “c:zip_format_file.txt” -S LKFW0133 -T
    Given a successful run you should see this in command prompt after executing the statement
    Starting copy...
    1000 rows sent to SQL Server. Total sent: 1000
    1000 rows sent to SQL Server. Total sent: 2000
    1000 rows sent to SQL Server. Total sent: 3000
    1000 rows sent to SQL Server. Total sent: 4000
    1000 rows sent to SQL Server. Total sent: 5000
    1000 rows sent to SQL Server. Total sent: 6000
    1000 rows sent to SQL Server. Total sent: 7000
    1000 rows sent to SQL Server. Total sent: 8000
    1000 rows sent to SQL Server. Total sent: 9000
    1000 rows sent to SQL Server. Total sent: 10000
    1000 rows sent to SQL Server. Total sent: 11000
    1000 rows sent to SQL Server. Total sent: 12000
    1000 rows sent to SQL Server. Total sent: 13000
    1000 rows sent to SQL Server. Total sent: 14000
    1000 rows sent to SQL Server. Total sent: 15000
    1000 rows sent to SQL Server. Total sent: 16000
    1000 rows sent to SQL Server. Total sent: 17000
    1000 rows sent to SQL Server. Total sent: 18000
    1000 rows sent to SQL Server. Total sent: 19000
    1000 rows sent to SQL Server. Total sent: 20000
    1000 rows sent to SQL Server. Total sent: 21000
    1000 rows sent to SQL Server. Total sent: 22000
    1000 rows sent to SQL Server. Total sent: 23000
    1000 rows sent to SQL Server. Total sent: 24000
    1000 rows sent to SQL Server. Total sent: 25000
    1000 rows sent to SQL Server. Total sent: 26000
    1000 rows sent to SQL Server. Total sent: 27000
    1000 rows sent to SQL Server. Total sent: 28000
    1000 rows sent to SQL Server. Total sent: 29000
    bcp import completed!
    BULK INSERT
    Next, we have BULK INSERT given the same format file from bcp
    CREATE TABLE zips (
    Col1 nvarchar(50),
    Col2 nvarchar(50),
    Col3 nvarchar(50),
    Col4 nvarchar(50),
    Col5 nvarchar(50),
    Col6 nvarchar(50),
    Col7 nvarchar(50),
    Col8 nvarchar(50)
    GO
    INSERT INTO zips
    SELECT *
    FROM OPENROWSET(BULK 'C:Documents and SettingstkruegerMy Documentsblogcenzuszipcodeszips.txt',
    FORMATFILE='C:Documents and SettingstkruegerMy Documentsblogzip_format_file.txt'
    ) as t1 ;
    GO
    That was simple enough given the work on the format file that we already did.  Bulk insert isn’t as fast as bcp but gives you some freedom from within TSQL and SSMS to add functionality to the import.
    SSIS
    Next is my favorite playground in SSIS
    We can do many methods in SSIS to get data from point A, to point B.  I’ll show you data flow task and the SSIS version of BULK INSERT
    First create a new integrated services project.
    Create a new flat file connection by right clicking the connection managers area.  This will be used in both methods
    Bulk insert
    You can use format file here as well which is beneficial to moving methods around.  This essentially is calling the same processes with format file usage.  Drag over a bulk insert task and double click it to go into the editor.
    Fill in the information starting with connection.  This will populate much as the wizard did.
    Example of format file usage
    Or specify your own details
    Execute this and again, we have some data
    Data Flow method
    Bring over a data flow task and double click it to go into the data flow tab.
    Bring over a flat file source and SQL Server destination.  Edit the flat file source to use the connection manager “The file” we already created.  Connect the two once they are there
    Double click the SQL Server Destination task to open the editor.  Enter in the connection manager information and select the table to import into.
    Go into the mappings and connect the dots per say
    Typical issue of type conversions is Unicode to non-unicode.
    We fix this with a Data conversion or explicit conversion in the editor.  Data conversion tasks are usually the route I take.  Drag over a data conversation task and place it between the connection from the flat file source to the SQL Server destination.
    New look in the mappings
    And after execution…
    SqlBulkCopy Method
    Sense we’re in the SSIS package we can use that awesome “script task” to show SlqBulkCopy.  Not only fast but also handy for those really “unique” file formats we receive so often
    Bring over a script task into the control flow
    Double click the task and go to the script page.  Click the Design script to open up the code behind
    Ref.
    Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/

  • Convert Epoch Date Time to Date Time format

    I am trying to convert Epoch Date time in GMT to Human Readable Date time format in UTC. I used the one below but it returns just the date in GMT but how can get datetime in UTC ?
    select To_Char( To_Date( '01.01.1970 06:00:00','DD.MM.YYYY HH24:Mi:Ss') + STARTIME / 86400,'DD.MM.YYYY HH24:Mi:ss') FROM HQ_AVAIL_DATA_RLE;
    I refered a couple of forums and applied everything, but still I wouldn't get the timestamp.
    Please note that i'm looking for datetime stamp, not just the date.
    Thanks in advance!
    Edited by: 830754 on Jan 27, 2011 11:18 AM
    Edited by: 830754 on Jan 27, 2011 11:19 AM

    Works for me. I see date and time (submitted 1000 for STARTTIME):
    select To_Char( To_Date( '01.01.1970 06:00:00','DD.MM.YYYY HH24:Mi:Ss') + 1000 / 86400,'DD.MM.YYYY HH24:Mi:ss')
    from dual
    TO_CHAR(TO_DATE('01
    01.01.1970 06:16:40Or do you mean something else?

  • SQL Server Date Conversion to Oracle Date

    I am new to ODI and am trying to figured out how to move a SQL Server date datatype value to an Oracle date.
    Thanks in advance.

    SQLServer datetime datatype is moved to an Oracle TIMESTAMP datatype via the technology's data type mapping. That particular LKM 'SQL to SQL' is written in java so reads from SQLServer into java datatypes then writes back out to Oracle.
    Cheers
    David

  • Failure Installing SQL Server Data Tools 2012 on Windows 8.1

    I am trying to install SQL Server 2012 with SQL Server Data Tools on my laptop with Windows 8.1 standard edition.  It fails each time when it gets to the SSDT installation with the same 1935 error, other features still install.  The error
    text is as follows:
    The following error has occurred:
    SQL Server Setup has encountered an error when running a Windows Installer file.
    Windows Installer error message: An error occurred during the installation of assembly 'Microsoft.VC80.CRT,version="8.0.50727.4053",publicKeyToken="1fc8b3b9a1e18e3b",processorArchitecture="amd64",type="win32"'. Please
    refer to Help and Support for more information. HRESULT: 0x80073715.
    Windows Installer file: F:\1033_ENU_LP\x64\setup\x64\SharedManagementObjects.msi
    Windows Installer log file: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20140220_201634\SharedManagementObjects_Cpu64_1.log
    Click 'Retry' to retry the failed action, or click 'Cancel' to cancel this action and continue setup.
    For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft%20SQL%20Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.3128.0&EvtType=0xDC80C325
    I have disabled any antivirus software that may have been interfering and am not sure what else to try.  Any assistance on how to resolve this error would be greatly appreciated.

    Hello,
    Please read the following article about the cause of that error:
    http://support.microsoft.com/kb/2688946/en-us
    I would like to recommend you the following procedure:
    http://www.sqlcoffee.com/SQLServer2012_0008.htm
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • SSIS: To run a SSIS package outside of SQL Server Data Tools you must install SCR - DP1 Connections of Integration Services or higher

    We have SSIS installed on a machine that is not part of a cluster but it is accessible by the cluster.
    Our job we have running on the cluster is failing with the following error:
    Error: 2014-01-31 09:14:37.52     Code: 0xC000F427     Source: SCR - DP1 Connections  
    Description: To run a SSIS package outside of SQL Server Data Tools you must install SCR - DP1 Connections of Integration Services or higher.  End Error
    Any advice or information on how to resolve this would be great.
    Many Thanks.

    Hi NessaBella,
    Integration Services service is not a cluster-aware service, and does not support failover from one cluster node to another. Therefore, in a clustered environment, Integration Services should be installed and started as a stand-alone service on each node
    in the cluster.
    Based on the error message, it seems that SSIS is not installed on the cluster node on which the job was running. Although SSIS is installed on a machine that is not part of the cluster and can be accessed by each cluster node, the SSIS service installed
    on a remote server cannot be used a cluster node. So, please install the shared feature SQL Server Integration Services on each cluster node. Besides, if certain packages need to run in 32-bit mode in certain jobs and the SQL Server installed is 64-bit version,
    you also need to install BIDS/SSDT on the cluster node to get the 32-bit runtime of SSIS.
    References:
    Integration Services (SSIS) in a Cluster
    Loading and Running a Remote Package Programmatically
    Regards,
    Mike Yin
    TechNet Community Support

  • Error "To run a SSIS package outside of SQL Server data tools you must install task name used in package of Integration service or highter.

    Hello Team,
    I am trying to execute a SSIS package from web page. When i try to do that i am getting following error.
    "To run a SSIS package outside of SQL Server data tools you must install <task name used in package> of Integration service or highter."
    In my machine Integration Services are installed and its service is also in running state.
    Please help me on this.
    Thanks,
    Ramesh
    Thanks, Ramesh Arige

    The SSIS package developed using SSIS 2008 Server R2 and Integrations Services 10.0 is exists in my machine. Is this wrong configuration, please help me on this.
    I am using the below code copied from CodeProject
    Thank you so much for responding.
    Ramesh
    Thanks, Ramesh Arige
    Which way are you using from the provided blog? Using 1) C# Code or 2) C# and Stored Procedure?
    Cheers,
    Vaibhav Chaudhari
    MCP, MCTS, MCSA (SQL Server 2012)

  • System Center 2012 R2 install: SQL server Data file and log file

    This might be a dumb question, but I can't find the answer anywhere.  
    I'm installing a new instance of  System Center 2012 R2 on a new server, I'm stuck on the SQL Server data file section.  Everytime I put in a path, it says that tne path does not exist.  I'm I supposed to be creating some sort of SQL Server
    data file and log file before this installation, I didn't get this prompt when installing System Center 2012 SP1 or hen I upgraded from System Center 2012 SP1 to System Center 2012 R2
    My SQL is on a different server
    Thank you in advanced

    Have you reviewed the setup.log?
    On a side note, why would you put the database file on the same drive as the OS? That defeats the whole purpose of having a remote SQL Server. Why use a remote SQL Server in the first place.
    Jason | http://blog.configmgrftw.com

  • Mapping between oracle data types and ms sql server data types

    hello
    i need mapping between oracle data types and ms sql server data types
    where can i find them ?

    read this
    http://download.oracle.com/docs/cd/E10405_01/doc/appdev.120/e10379/ss_oracle_compared.htm

  • SQL Server Data Tools – Business Intelligence for Visual Studio 2013 (SSDT BI) and SSIS on SQL Server 2012

    This great blog entry titled
    SQL Server Data Tools - Business Intelligence for Visual Studio 2013 (SSDT BI), link below, highlights the lack of support for SSIS projects using SQL Server 2012, VS 2013 and SSDT BI for VS 2013. I see there is a new version
    on SSDT BI for VS 2013 (12.0.2430.0, File Name: SSDTBI_x86_ENU.exe, Date Published: 10/27/2014) link below.
    Does this version support SSIS projects using SQL Server 2012 using VS 2013 and SSDT BI for VS 2013?
    http://blogs.msdn.com/b/analysisservices/archive/2014/04/02/sql-server-data-tools-business-intelligence-for-visual-studio-2013-ssdt-bi.aspx
    http://www.microsoft.com/en-us/download/details.aspx?id=42313

    Hi cjrinpdx,
    According to the picture, it seems that we can use SSIS 2012 support is not included in SSDT-BI for VS 2013. And based on the previous versions, SSIS always different from SSRS, SSAS.
    SSDT-BI for Visual Studio 2012 supports versions of SQL Server as follows:
    SSAS project can target SQL 2012 or lower
    SSRS project can target SQL 2012 or lower
    SSIS project can target only SQL 2012
    The following blog is for your reference:
    http://blogs.technet.com/b/dataplatforminsider/archive/2013/11/13/microsoft-sql-server-data-tools-update.aspx
    Since I have no environment to test this at this moment,
    I recommend you that submit the feedback at
    https://connect.microsoft.com/SQLServer/. 
    Thank you for your understanding.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • The February 2015 release of SQL Server Data Tools is now available for download

    We'd like to announce the availability of the latest February 2015 release of SQL Server Data Tools.
    This update is now available for Visual Studio 2012 and 2013. For Visual Studio 2012, use the SQL > Check for Updates tool inside Visual Studio. For Visual Studio 2013, check the Visual Studio update channel (Tools > Extensions and Updates > Updates)
    for this update.  Alternatively, administrative installs are available via the link below.
    Get it here:
    http://msdn.microsoft.com/en-us/data/hh297027
    What’s New?
    Support for the latest Azure SQL Database V12 features
    Improved Cross-Platform Schema Comparison
    New advanced publish options
    Fixes for customer reported issues
    For more details, see the SQL Server Data Tools team blog:
    http://blogs.msdn.com/b/ssdt/archive/2015/03/03/sql-server-data-tools-and-data-tier-application-framework-update-for-february-2015.aspx

    While we are investigating this issue, you can revert to the November release with the links below.  You will need to uninstall your current SSDT.MSI and then run the installer from these ISOs.
    Visual Studio 2012 versions:
    SSDT_11.1.41025.0_BR.iso
    SSDT_11.1.41025.0_CN.iso
    SSDT_11.1.41025.0_DE.iso
    SSDT_11.1.41025.0_EN.iso
    SSDT_11.1.41025.0_ES.iso
    SSDT_11.1.41025.0_FR.iso
    SSDT_11.1.41025.0_IT.iso
    SSDT_11.1.41025.0_JA.iso
    SSDT_11.1.41025.0_KO.iso
    SSDT_11.1.41025.0_RU.iso
    SSDT_11.1.41025.0_TW.iso
    Visual Studio 2013 versions:
    SSDT_12.0.41025.0_BR.iso
    SSDT_12.0.41025.0_CN.iso
    SSDT_12.0.41025.0_DE.iso
    SSDT_12.0.41025.0_EN.iso
    SSDT_12.0.41025.0_ES.iso
    SSDT_12.0.41025.0_FR.iso
    SSDT_12.0.41025.0_IT.iso
    SSDT_12.0.41025.0_JA.iso
    SSDT_12.0.41025.0_KO.iso
    SSDT_12.0.41025.0_RU.iso
    SSDT_12.0.41025.0_TW.iso

  • Association rule in SQL Server Data Mining

    I have been working on a problem on association rules in SQL Server Data Tools (Visual Studio 2008) for quite a while but have not yet been able to figure out the solution.
    The problem is: I have a table named Sales_history in my SQL database. This table has following columns: CustomerID, ItemID, Month (from May2012 to April 2013), QtyShipped. I am looking to find association between Items and i want to provide recommendation
    to the Customer (In this case CustomerID) based on their purchases.
    Note: there are around 630 customers and about 34000 products in my table. 
    My approach:
    I marked History_Table as both Key and nested. And in the Key, i checked CustomerID as input and Key whereas in nested, i checked ItemId as Key, input and Predict. 
    When i run the model, i get a solution but i am not sure if i am configuring it right. Also i am not sure how i can write prediction join query to generate Item recommendations . I am really struggling with
    this problem, eagerly waiting for the reply. Thank you.

    Hi Tatyana,
    Thank you so much for your reply. I have now been able to create the data mining model using association rule and by writing a DMX query, i am able to generate the item recommendations to be given to customers for items they have purchased. However, i have
    noticed one thing that in the DMX query, it gives the same item recommendation for any item i put inside the query. 
    Also, if i put any item in the DMX query from the generated list of recommended items, the output of that query also shows the item that is inputted inside the query.
    Here is the query, that i am writing to generate item recommendations
    SELECT predictassociation (CrossSellingModelV3.[Ztb Customer Item v3],INCLUDE_STATISTICS,5)
    FROM CrossSellingModelV3
    NATURAL PREDICTION JOIN 
    (SELECT
    (SELECT '17IS56126' as m )
    AS Ms)
    AS t
    What can be the possible reason behind this? Is this something related to the kind of data i have? In my data, there are 632 distinct customers and 34000 distinct products. 
    If i execute this query in management studio.
    select customer_CD, COUNT(Item_CD) from ztb_Sales_History
    group by customer_CD
    order by 2 desc
    the output shows that  there are some customers who have bought just 1 item and also there are customers who have bought 2400 items. i mean the range is very high. 

  • Access SQL-Server Data from Oracle 10gXE

    Hello,
    I want to access sql-server data from oracle 10g XE. I need the same functionality provided by Sql-server by Linked Servers, by which we can query on any data source(oracle, Excel, Access).
    do, Oracle 10gXE provide us with same functionality ???
    any pointers ???

    Yes, it does work with Express Edition.
    Here is a thread from the XE forum with examples.
    Re: Database Link to MS Access
    They refer to a MS Access database, but the procedure is the same.
    Doug

Maybe you are looking for

  • Mid-2010 Macbook Pro Kernel Panic

    Hi, I have a Mid-2010 MacBook pro (2.66 GHz Core i7) running OSX 10.6.8  that has been frequently crashing/kernel panic recently. This happens mostly when I am playing games, such as league of legends, but has also happened during times of low usage

  • Virtual IP address in Failover Cluster Manager

    Dear All, I want assign virtual IP address to cluster server windows 2012 but this Ip address is not given to physically. i am creating host entry with ip address and hostname but i am not able to ping. is there any way to ping this ipaddress? i am o

  • I think my motherboard might be done. :(

    Here's my post from another forum: I started having problems with my computer a few weeks ago, and they just kept getting worse and worse. Here are my specs: Intel Q6600 MSI P6N SLI Platinum 500W Ultra PSU (crappy, I know) I originally had 2x2GB Cors

  • Ssrs 2008 r2 export to csv file problem

    In an SSRS 2008 R2 report, the users are going to export the data to: csv (comma delimited) and  excel. I am using the following to display if a column is visible or not: =IIF(Mid(Globals!RenderFormat.Name,1,5)="EXCEL" AND First(Len(Fields!CustomerNu

  • Service for Object attacchements database

    Hy guys, does anybody know where SAP stores(i mean dictionary.....) attacchements by "Service for Object functionality" ? i need to develop a custom program.............. thanks a lot. Cheers.