Appropraite Datatypes

  • What will be the appropriate datatypes for following

    Username

    Machinename

    Executionstarttime

    Packagename

    ExecutioninstanceGUID

    Help Appreciated

  • That's really not enough information, but if I had to guess based on the field names:

    Username nvarchar(50)

    Machinename nvarchar(50)

    Executionstarttime datetime

    Packagename nvarchar(100)

    ExecutioninstanceGUID uniqueidentifier

    Note the word *guess*.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • Garadin (12/15/2008)


    That's really not enough information, but if I had to guess based on the field names:

    Username nvarchar(50)

    Machinename nvarchar(50)

    Executionstarttime datetime

    Packagename nvarchar(100)

    ExecutioninstanceGUID uniqueidentifier

    Note the word *guess*.

    Or

    Username sysname,

    Machinename sysname,

    Executionstarttime datetime,

    Packagename sysname,

    ExecutioninstanceGUID uniqueidentifier

  • Appropriate datatypes depends entirely upon your application and data usage.

    From your column name list, the only obvious choice is

    ExecutioninstanceGUID should be a uniqueidentifier.

    Executionstarttime could be either a datetime or smalldatetime depending on if seconds/milliseconds are significant.

    The remaining columns should probably be varchars and their lengths determined by representative data.

  • Thank you very much i apprerciate your help

  • Thank you very much i apprerciate your help

  • Thank you very much i apprerciate your help

  • Lynn Pettis (12/15/2008)


    Or

    Username sysname,

    Machinename sysname,

    Executionstarttime datetime,

    Packagename sysname,

    ExecutioninstanceGUID uniqueidentifier

    For anyone else that is unfamiliar with sysname data type.

    FROM 2K8 BOL:


    sysname

    The sysname data type is used for table columns, variables, and stored procedure parameters that store object names. The exact definition of sysname is related to the rules for identifiers. Therefore, it can vary between instances of SQL Server. sysname is functionally the same as nvarchar(128) except that, by default, sysname is NOT NULL. In earlier versions of SQL Server, sysname is defined as varchar(30).

    Important:

    In databases that are case-sensitive, or that have a binary collation, sysname is recognized as a SQL Server system data type only when it appears in lowercase.

    Not sure what version marked the change in default from varchar(30) --> nvarchar(128).

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • antonio.collins (12/15/2008)


    Appropriate datatypes depends entirely upon your application and data usage.

    From your column name list, the only obvious choice is

    ExecutioninstanceGUID should be a uniqueidentifier.

    Executionstarttime could be either a datetime or smalldatetime depending on if seconds/milliseconds are significant.

    The remaining columns should probably be varchars and their lengths determined by representative data.

    Personally, I'd stay away from the smalldatetime data type. It may take up less space, but I'd be concerned with creating a "Y2K" issue that may not be solved by a newer version of SQL Server between now and 2079. It will be here sooner than you know.

  • Lynn Pettis (12/15/2008)


    Personally, I'd stay away from the smalldatetime data type. It may take up less space, but I'd be concerned with creating a "Y2K" issue that may not be solved by a newer version of SQL Server between now and 2079. It will be here sooner than you know.

    if any is still using my code 60 years from now, they deserve to suffer! 😀

    but seriously, if the business requirement anticipates dates 50 years in the future, then certainly use smalldatetime. btw, if time isn't significant, we generally use an int to represent dates in yyyymmdd format. it suits our requirements to a T.

Viewing 10 posts - 1 through 9 (of 9 total)

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