Professional Web Applications Themes

String Date v DateTime - Microsoft SQL / MS SQL Server

If I have my own formatted string date "yyyyMMddHHmmss" what kind of performance am I loosing as compared to using the native DateTime for my SQLce db. The database isn't that big Anyone ever do this?...

  1. #1

    Default String Date v DateTime

    If I have my own formatted string date "yyyyMMddHHmmss" what kind of
    performance am I loosing as compared to using the native DateTime for my
    SQLce db.

    The database isn't that big

    Anyone ever do this?


    BadMrFrosty Guest

  2. #2

    Default Re: String Date v DateTime

    If all you're doing is storing it, you're not losing much (except that
    format requires 14 bytes, whereas DATETIME only requires 8).

    However, if you have to use string parsing to perform any kind of date
    calculations, you'll be losing quite a bit. Why do you want to use your own
    formatted string? What are you gaining this way?




    "BadMrFrosty" <com> wrote in message
    news:u7DyC#phx.gbl... 


    Aaron Guest

  3. #3

    Default Re: String Date v DateTime

    I don't think performance is a major worry, but how are you going to prevent
    users from storing invalid dates in your database? That is going to take a
    lot of coding.

    You can quite easily get the format you want by combining two CONVERTs:

    SELECT CONVERT(CHAR(8), GETDATE(), 112) + REPLACE(CONVERT(VARCHAR(8),
    GETDATE(), 8) , ':', '')

    --
    Jacco Schalkwijk MCDBA, MCSD, MCSE
    Database Administrator
    Eurostop Ltd.


    "BadMrFrosty" <com> wrote in message
    news:u7DyC#phx.gbl... 


    Jacco Guest

Similar Threads

  1. Replies: 9
    Last Post: October 24th, 07:31 PM
  2. # in string/datetime SQL query
    By Eric Bobo in forum ASP Database
    Replies: 0
    Last Post: August 22nd, 03:31 PM
  3. Compares just date instead datetime
    By Wayne Gillespie in forum Microsoft Access
    Replies: 2
    Last Post: July 22nd, 02:52 PM
  4. Date from datetime
    By Ray in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: July 15th, 01:07 AM
  5. Display datetime value as date only
    By Dale Fye in forum Microsoft SQL / MS SQL Server
    Replies: 6
    Last Post: July 11th, 06:50 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139