SQL Datatype

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Darshini
    New Member
    • Oct 2007
    • 10

    SQL Datatype

    Hi
    im using SQL2000 in my query should contain column name date so i mention the datatype as datetime what's my doubt mean is any possible without displaying the time?Then is any possible to change the datatype range for int etc...other than nvarchar what's the datatype we will mention for phone no column.Advance thanks...
  • JamieHowarth0
    Recognized Expert Contributor
    • May 2007
    • 537

    #2
    Hi Darshini,

    With datetime, as far as I am aware (especially when using Microsoft SQL Server) you are able to select the format of data to be stored, similar to Microsoft Access - long, medium or short date etc. - but you are not able to remove the functionality of the field to hold time information.

    For nvarchar (or int) fields storing telephone numbers, use nvarchar. You cannot get an int field to store a leading 0 which most countries employ for dialling internally (certainly here in the UK they do), the system would automatically trim off any leading zero (although you could compensate for this programatically but I wouldn't like to try it). Safest bet - stick to nvarchar.

    I also moved your thread as this is an SQL Server-related question, not an ASP one. Please use the appropriate forum in future.

    Best regards,

    medicineworker

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      if you want not display the time part of your datetime field, whether it's smalldatetime or datetime, you have to handle that on your front-end, not on the back-end.

      i agree with medicineworker, you have to use nvarchar. i saw some phone numbers with access code (usually "0" or "011" ) + area code (could sometimes go up to 4-digit) + the 7 digit phone number. that's an 11 (or 13) -digit integer. and, yes, you will loose the access code. that's trillion (comes after billion, right?). you might not be able to sequentially populate it, since there are no phone numbers that starts with "0", but you have still to accommodate the full size of the number.

      -- CK

      Comment

      Working...