How to insert to smalldatetime in sql-server

hi
i trying to insert date to smalldatetime in sql-server
i try something like this:
DateTime  transfer_date;
transfer_date = DateTime.Now;
SQL = "insert into MyTbl (DateT) values (transfer_date)";
SqlCommand Cmd_SQL = new SqlCommand(SQL, Conn_SQL);
Cmd_SQL.CommandText = SQL;
Cmd_SQL.ExecuteNonQuery();
but i got this error:
The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value. The statement has been terminated.

 I cannot test it right now but what is the value of transfer_date variable?
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • How to "insert" current datetime in SQL Server

    I am having trouble converting current datetime into proper format that can be used to insert values in the SQL Server database.Among other things, I also tried SimpleDateFormat which does not recognise the month value of Date() object. I have been at this for a long time now and would really appreciate some assistance with this. Thanks in advance!!

    You can try TimeStamp object
    and setting the value like
    pstmt.setTimestamp( 1, timeStamp );

  • *Urgent*How to insert data from MS SQL to the table that create at the adobe form?

    Hi,
    I'm using Adobe life cycle designer 8 to do my interactive form. I would like to ask how to insert data from MS SQL to the table that i have created in my adobe interactive form?
    I really need the information ASAP as i need to hand in my project by next week... i really appreciate any one who reply this post.
    Thanks

    Tou need to do a couple of things
    1. On the Essbase server, set up an odbc system connection to your MySQL database
    2. In the load rule , go to the file menu and select open SQL data source and in the data source put in your SQL statement . A couple of hints. Where it says Select, don't put in the word select and where it say from don't put in from. The system adds them for you. The easiest way ti enter a SQL statement is to do it all in the select area So if your SQL would normanlly say select * from mytable just enter the code as * from mytable in the select area
    The click ol/retrieve and enter in your connection info. Itshould bring data back into the load rule. Save the load rule and use it

  • How to create a database in Sql server management studio

    how to create a database in Sql server management studio

    One method is to run the SQL statement below from a SSMS query window:
    CREATE DATABASE MyDatabase;
    You can also right-click on the Databases node in SSMS Object explorer and select New Database.
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • How to connect external database(Ex:SQL Server/Tivoli)  from ABAP Webdynpro

    Hi,
    Any one have idea how to connect external database like SQL Server/Tivoli to access tables from WebDynPro ABAP.
    Please point to me some links if you have
    Thanks
    Praveen

    Hi,
    Please check out this link -
    FETCH DATA FROM ORACLE DATABASE USING Web Dynpro
    Regards,
    Lekha.

  • How to open sdf files in SQL server 2012?

    How to open sdf files in SQL server 2012?
     I couldn’t figure out how to open the sdf files in SQL server 2012
     Thank you
     Best
     Jamal

    I don't think it's hard if understood the question properly you can try this I do it most of the time and this might be the solution for you, sometimes minor simple click is a life saver:)
    1. 
    Open SQL Server Management Studio, or if it's running select File -> Connect Object Explorer... and click the
    connect drop down arrow
    2. 
    In the Connect to Server dialog you will see Database Enghine, Analaysis Servie on so on and you go head change Server type to
    SQL Server Compact Edition
    3. 
    From the Database file drop-down as shown below click the drop down arrow and select <
    Browse for more...>
    4. 
    And you will see C:\, D:\, G:\
    drive and so on and open, your SDF file where it is located
    I hope this has been informative for you and good luck
    Please remember to click “Mark as Answer” on the post that has answered your question as it is very relevant to other community members dealing with same problem in seeking the right answer

  • How to store jpeg images in SQL server using NI database Connectivity Toolset. Can anyone please help me in this regard.

    Please tell how to store jpeg images in SQL Server using NI Database Connectivity Toolset.

    http://www.w3schools.com/sql/sql_datatypes.asp
    You setup a field as BLOB and store the binary of the picture there. Depending on the database it can be called differently as you can see in the link, in SQL server there's even a Image datatype.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • How to install and configure the SQL Server

    Hi All,
    We have to install SQL server in the new server because the old server is crash and need to upgrade. Please advice How to install and configure the SQL Server to run SAP Business One 8.8 successfully and what part we do have to give attention.
    Kind Rgds,
    Steve

    Hi,
    Try this solution:
    The step-by-step installation guide can be found in the documentation included in the installation media. (\Documentation\SystemSetup\AdministratorGuide_SQL.pdf).
    Below are some important parts that you should pay attention to during the Installation process.
    Resolution
    Collation setting: It must be set as SQL_Latin1_General_CP1_CI_AS,even the company DB is non-english location. The company DB will be created as corresponding collation settings automatically.
    Instance and TCP Port : It is recommended to run SBO on default instance and TCP port 1433. Otherwise,some optional components such as B1i may not work properly.
    Native Client: SQL Server Native Client should be installed on every client machine to enable the ODBC connection to DB server.
    Rgds,

  • How to replicate data from MS SQL Server  to Oracle

    Hi,
    Can someone please help me on how to replicate data from MS SQL Server to Oracle 8i database.

    Dear,
    I'm a student.
    I do simple replication on Oracle 8.0.5 successfully. (one master site and one snapshot site). I only use the SQL*Plus and Schema Manager to do.
    But when I do advance replication (multimaster replication) I meet many problem. So I don't get the result.
    Do you show me the technology to do that ?
    Thanks !

  • How to store 999999999.00000000 in sql server through ssis package?

    I have a field with 999999999.00000000 value of datatype double ?
    How to store it in ms sql server 2005 db through ssis package ?
    give me details if I have to use derived columns and what to write over there.
    please write in details as I am new to SSIS.
    Thanks in Advance.

    The value is coming from informix db .
    Can u please suggest hw to write it in my package : 
    I have taken a OLE DB Source and wrote the follwing command :
     " select CASE WHEN T1.t_maxs IS NULL THEN 0.00 ELSE T1.t_maxs END as max_inv
    from  ttiitm001010 T1 ".
    Please give details, as i am new ...

  • How to load oracle data into SQL SERVER 2000?

    how to load oracle data into SQL SERVER 2000.
    IS THERE ANY UTILITY AVAILABLE?

    Not a concern for an Oracle forum.
    Als no need for SHOUTING.
    Conventional solutions are
    - dump the data to a csv file and load it in Mickeysoft SQL server
    - use Oracle Heterogeneous services
    - use Mickeysoft DTS
    Whatever you prefer.
    Sybrand Bakker
    Senior Oracle DBA

  • How does one install a express sql server to run with Visual Web Developer 2008?

    I successfully installed .NET framework v 3.5 and VWD 2008 on a new Vista laptop. When I want to add a Sql Server database to a website, errors tell me to install SS 2005 Express. MSDN SS 2005 Express download tells me I MUST  first install .NET framework v 2.0 before SS 2005. When I try to install framework v 2.0, I'm sent to v. 3.5 and no way to download SS 2005.
    How does one install a express sql server to run with Visual Web Developer 2008?   

    Momark,
    Do you still need help with this?
    Thank you!
    Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • How to activate evaluation version of SQL server

    How to activate evaluation version of SQL server 2012 with open license.
    in the VLS portal it is saying no product key is require. but my problem is i already installed evaluation version of SQL server 2012 and configure many things to it. after that i got open license from Microsoft,

    Hi,
    If you want to upgrade ( i Guess this is what you want) evaluation edition to enterprise or standard you need to run Ent/ standard edition from setup.exe installation window will pop up on that select maintenance on left side and then select edition
    upgrade.
    Take help of below link
    http://blogs.technet.com/b/sqlman/archive/2010/03/16/sql-server-2008-upgrading-to-standard-enterprise-edition-from-evaluation-edition.aspx
    revert if any issue.
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

  • How to create CATALOG with MS SQL Server?

    Connection class has getCatalog(strCatalog) method. In order to use it, we must create CATALOG in Database?
    How to create CATALOG with MS SQL Server?
    Help me, please!!!

    You do not create these for any database, this is part of the Connection metadata.
    The Catalog is the third level of table-like database object qualification as in "Catalog.Schema.Table". For SQLServer the qualification scheme is "Database.Owner.Table" and I would be surprised if they reported anything for the current connections getCatalog() method call.
    What many people do is avoid table qualification altogether by setting the connection's context in a database proprietary manner and then keeping the SQL as clean as possible. For many ODBC and JDBC drivers this can be set in the configuration. For MS SQLServer you can also execute a "USE dbname" statement on the connection to avoid table qualification.

  • Problem inserting date into MS SQL Server

    I am trying insert date into MS SQL Server database. First I used Statement and when I insert the date only date used to be inserted properly and the time used to be always 12:00:00 AM. I tried PreparedStatement and when I insert I get an error message:
    SQL Error: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented
    I have attached the code.
    GregorianCalendar cal = new GregorianCalendar();
    java.util.Date dtm = (java.util.Date)cal.getTime();
    SimpleDateFormat formatOb = new SimpleDateFormat("dd/MM/yy hh:mm:ss");
    String date= (String)formatOb.format(dtm);
    dateCreated = new java.sql.Date(formatOb.parse(date).getTime());
    PreparedStatement psmt = con.prepareStatement("INSERT INTO Resume (ResumeName, Summary, Skills, OtherInformation, Interests, Memberships, Languages, Category, DateCreated, SupervisorName) VALUES(?,?,?,?,?,?,?,?,?,?)");
    psmt.setString(1, name);
    psmt.setString(2, summary);
    psmt.setString(3, skills);
    psmt.setString(4, info);
    psmt.setString(5, interest);
    psmt.setString(6, member);
    psmt.setString(7, language);
    psmt.setString(8, category);
    psmt.setDate(9, dateCreated);
    psmt.setString(10, loginName);
    psmt.executeUpdate();
    Any suggestions will be really helpful.

    Thanks,
    I changed the field in the database of DateCreated to timestamp, but when I insert the some binary data is inserted into the database. something like 0000000000000017D.
    I installed jtds-0.8.1 driver from source forge. but when try to connect to the database I get an error as:
    Connection refused: connect
    Error: Connection refused: connect
    I have attached the code for setting the driver and url also.
    private String driver = "net.sourceforge.jtds.jdbc.Driver";
    private String url = "jdbc:jtds:sqlserver://TEKKATTE:1433/placement;TDS=7.0";

Maybe you are looking for

  • Error while creating OCA application in NWDS 7.1

    Dear Experts, I am creating mobile application for Handhelds (OCA) using mobile 7.1. I created the service component, ui component and application component. Added the dependencies, build the application, uploaded the 3 components to the server, assi

  • Error message after upgrading to 7.3

    i upgraded to iTunes 7.3 and i got a message that said something about some files were missing and i needed to uninstall and try again. i uninstalled it and now i can't even download iTunes. i can download but i can't do anything else. anybody else h

  • Purchase order number addition to Delivery

    what is the process of adding the purchase order to a return delivery. Plz let me know. Thanks. Edited by: raghav nba on Nov 25, 2008 9:40 PM

  • Scheduling a document

    Hello, I am trying to schedule a document and save it on server local drive. Works fine! But if i try to save it over the network it comes back with an error, saying that "Bad user name or password". I tried all combination and it does not work. Stra

  • Problem using TaskService

    Hi, I'm trying to update a task programatically using taskservice. When I execute this lines: ITaskService taskSvc = this.getWorkflowServiceClient().getTaskService(); taskSvc.updateTask(this.getWorkflowContext(),task); I get the following stacktrace: