All columns as VARCHAR

  • I have a situation where the developer is writing an application that extracts data from various SQL Server tables and stores it into 3 result tables. The data types on the result tables are all VARCHAR. The developer's argument is that the result data is stored for as long as the user web session lasts. Once the session is over, the application deletes all the result data for that user. Sort of transient data.

    Can these tables be exempt from usual design rules and data typing imposed on permanent tables?

    Ben

     

  • No. The only case where I'd find that "acceptable" is when the data is the other databases is unsafe and that it could cause errors in the transfer. Other than that it should be a normal table.

  • Standards are meant to be followed, although not 'rigidly' ... as with most sets of rules there are always going to be exceptions. So here's my thinking ... #tables ('true' temp tables), session specific named tables in tempdb or 'normal' user database tables all should adhere to the same basic rules (whatever they are. at your site). I'd meter this in your example by stating that since the application pulls data from user database tables and stuffs it into 'temp' tables prior to posting the information on a web-page the following should also be true: The source table data type and target temp table datatype should be identical. This means if it starts out as char(10) it stays char(10), not turning into varchar(255). Likewise, int to int, etc. Any formatting or data type casting/conversion are the responsibility of the programmer and the function of the web page. No conversions whether imlpicit or explicit should occur in the transfer of the information from table to table in this instance. Just from table to web page.

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

Viewing 3 posts - 1 through 2 (of 2 total)

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