Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
asm
Posting Yak Master
140 Posts |
Posted - 2007-10-31 : 03:39:32
|
| HiI my database i am using varchar(50) data type and problem is for every filed i have to assign the size of varchar i.e. varchar(10), varchar(100) etc...Problem occur when the programmer forget to fixed the length of acceptance of data in frot end and user give the data more than 10 digit .. it will display an error message.So, In Sql Server 2005 .. data type is varchar(max) , So I want to know I can change the data type of every varchar(1), varchar(10), varchar(100) etc... to varchar(max)thanks |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2007-10-31 : 04:02:41
|
| Even though it is tempting to use this method , from a db architecture point of view , the data model should constrain the size and act as a rough guid to the user interfaceJack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-31 : 04:16:43
|
| You need to restrict users at front end typing more than the allowed length of charactersMadhivananFailing to plan is Planning to fail |
 |
|
|
arorarahul.0688
Posting Yak Master
125 Posts |
Posted - 2007-10-31 : 08:54:36
|
| you can't use as such varchar(max) in database as it quite' possible that different entries in same field are of varing lengthlikef_name-------rahulashishramjohnalexzenderso in that case if restrict the length by max it will have to be done by buisness logic that first find the length ofeach entry in same field then find maximum of thoseand then decided the length of column it may be done at front end of your applicationlike at click event of any button bt CAN't BE APPLIED DIRECTLY in databaseRahul Arora MCA 07 BatchNCCE Israna, PanipatHRY, INDIA |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2007-10-31 : 09:01:24
|
quote: Posted - 10/31/2007 : 08:54:36-------------------------------------------------------------------------------- you can't use as such varchar(max) in database as it quite' possible that different entries in same field are of varing lengthlikef_name-------rahulashishramjohnalexzenderso in that case if restrict the length by max it will have to be done by buisness logic that first find the length ofeach entry in same field then find maximum of thoseand then decided the length of column it may be done at front end of your applicationlike at click event of any button bt CAN't BE APPLIED DIRECTLY in databaseRahul Arora MCA 07 BatchNCCE Israna, PanipatHRY, INDIA
eh? i think OP meant using the datatype varchar(max) i.e. the SQL2005 replacement for text datatypeEm |
 |
|
|
|
|
|
|
|