Results 1 to 3 of 3

Thread: check on a SQL stetement I am writing at the point of INSERT statement

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2004
    Posts
    790

    check on a SQL stetement I am writing at the point of INSERT statement

    in a final INSERT statement to a table in the dates that are showing up as 99991231 as a default end date we want to replace them with 20781231 no dashes in between
    hence I used the following
    Code:
    CASE WHEN CONVERT(VARCHAR, EndDate, 112) = '99991231' THEN CONVERT(DATE, '20781231') ELSE CONVERT(DATE, EndDate) END as EndDate
    But 99991231 is stil showing up and I wondering if I need to use the REPLACE function in this logic after the THEN ?

    Any ideas ?

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: check on a SQL stetement I am writing at the point of INSERT statement

    Can you show your full SQL Statement? The alias on the end makes it look more like its part of a select than an insert.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,440

    Re: check on a SQL stetement I am writing at the point of INSERT statement

    And whats the DataType of the Column?
    In our ERP-System we have the "same" for Dates, but they are Integers, not VARCHAR

    EDIT: Which DBMS? MS SQL?
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width