NEWBIE : SQL Data Type?

  • Just getting start of SQL. Does anyone has a good reference or link of SQL datatype ??

  • Books Online, which is the documentation that comes with SQL Server, has all the information you need including how data types implicitly convert, etc.

    K. Brian Kelley

    http://www.truthsolutions.com/

    Author: Start to Finish Guide to SQL Server Performance Monitoring

    http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1

    K. Brian Kelley
    @kbriankelley

  • I have another question:

    I have two fields in my table: ReportStart and ReprotEnd. I need to store date into these two fields.

    Should I set the datatype of these two fields to smalldatetime? will it also stored the time as well?? Anyway around this?

    Thank you very much. I'm really appreciated because you're willing to help a newbie out.

  • Either date field type will store a time. The difference is what are acceptable dates, and whether the time is store as minutes or milliseconds.

    If you truely don't what a time you can always store a date in a char(8) field like '20021002' for October 2, 2002. This char field can then be convert to a datatime variable if needed.

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

  • Yes all datetime datatypes store the time. If you don't want the time to interfere with specific queries you can also do CONVERT(CHAR,COLNAME,101) in your query or on the INSERT to convert to mm/dd/yyy which will store with time of 00:00:000. Or go with Gregs solution.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply