Solved

varchar length

Posted on 2002-07-09
6
655 Views
Last Modified: 2008-07-03
I am facing a problem with the varchar data type in Microsoft SQL Server 7.0

Whenever I use this datatype its length doesnot automatically increases to accomodate the characters although they are less than 100 characters let alone 8K limit.

Even after repeated tries I am unable to make the length flexible.

Please advise
0
Comment
Question by:Pragam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7141643
Did you try:

Declare @Variable varchar(8000)

Otherwise try posting your code.

Anthony
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 7141644
When you define a column, the length you specify specifies the maximum length that column can reach.  For example:

CREATE TABLE anyTable (col1 VARCHAR(50))

col1 cannot exceed 50 characters; SQL will not automatically increase the max length of the column to allow it tho hold more data, it will simply truncate (chop off) the value.



0
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 50 total points
ID: 7141647
If needed, you can increase the length of the table by altering the column.  For example:

ALTER TABLE anyTable
    ALTER COLUMN col1 VARCHAR(2000)

would increase the max length of col1 to 2000 characters.
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 7141649
By the way, if you don't specify a length, it will default to ONE (except in CAST/CONVERT, in which case it defaults to 30).
0
 

Expert Comment

by:CleanupPing
ID: 9280171
Pragam:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question