Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789

    Unanswered: Stupid question I'm sure

    is there a way to format data on the tables. Such as Social security numbers 00/00/0000 or formating of dates 99/99/0000;0;_

    is there a way of doing that on a sql table maybe??

  2. #2
    Join Date
    Feb 2004
    Posts
    193
    Why do you want to do that? You can put it into a varchar field by creating the table with a field of this datatype but that is unusual. Formatting is done upon selecting data from the table.

    Use style numbers if that helps you, ie:
    Code:
    Style No.	SQL statement		                Example of output
    100	        select convert(varchar,getdate(),100)	Sep  2 2004  2:39PM
    101	        select convert(varchar,getdate(),101)	09/02/2004
    102	        select convert(varchar,getdate(),102)	2004.09.02
    103	        select convert(varchar,getdate(),103)	02/09/2004
    104	        select convert(varchar,getdate(),104)	02.09.2004
    105	        select convert(varchar,getdate(),105)	02-09-2004
    106	        select convert(varchar,getdate(),106)	02 Sep 2004
    107	        select convert(varchar,getdate(),107)	Sep 02, 2004
    108	        select convert(varchar,getdate(),108)	14:41:01
    109	        select convert(varchar,getdate(),109)	Sep  2 2004  2:41:01:253PM
    110	        select convert(varchar,getdate(),110)	09-02-2004
    111	        select convert(varchar,getdate(),111)	2004/09/02
    112	        select convert(varchar,getdate(),112)	20040902
    113	        select convert(varchar,getdate(),113)	02 Sep 2004 14:43:29:967
    114	        select convert(varchar,getdate(),114)	14:43:29:967
    ddave

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Formatting data really ought to be done on the client, not the server. You can format the data on the server, but once you've done that you're forcing every client to use a single format. This becomes a serious problem when you are trying to scale your application up, especially if you need to support more than one locale.

    -PatP

  4. #4
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789

    thank you

    thank you Pat thats the answer I was looking for I had a feeling that would cause alot of issues I just wasnt sure.

    Thank you

Posting Permissions

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