473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Setting column length in sql ?

Please let me know if there is a more suitable group to post in.

In query analyzer I do :

alter table mytable
add mycolumn varchar default 50

But when I check in Enterprise manager the column has a length of 1 rather
than 50.

What am I doing wrong?

Thanks.

Cheers - Tom.

"Do you know what a metaphysical can of worms this portal is?" Craig
Schwartz, Being John Malkovich (1999)

Jul 20 '05 #1
3 4770
You need to give a length; VARCHAR by itself is the same as VARCHAR(1).

--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #2

"Tom Corcoran" <to*****************@nospam.btinternet.com> wrote in message
news:bu**********@titan.btinternet.com...
Please let me know if there is a more suitable group to post in.

In query analyzer I do :

alter table mytable
add mycolumn varchar default 50

But when I check in Enterprise manager the column has a length of 1 rather
than 50.

What am I doing wrong?

Thanks.

Cheers - Tom.

"Do you know what a metaphysical can of worms this portal is?" Craig
Schwartz, Being John Malkovich (1999)


I think you're probably looking for this:

alter table mytable add mycolumn varchar(50)

Your code adds a new varchar(1) column with a default integer value of 50.

Simon
Jul 20 '05 #3
> alter table mytable add mycolumn varchar(50)
Your code adds a new varchar(1) column with a default integer value of 50.


Thanks guys, that's it. tom.
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Peter Scott | last post by:
I created a table that has a column in that needs to contain a full Unix file path. Since 2048 was too long for a VARCHAR, I made it TEXT. I since populated the table. Now I want to make the...
2
by: Ridge Burner | last post by:
I have a 3 column table with the main content of the page in the center column, pretty basic. I have a DIV in the right column that holds links, and which is nearly always taller than the content...
5
by: Robert Stearns | last post by:
Either I missed something, or ALTER TABLE does not have this capability. Is there any way of doing it except DROPping all constraints which mention this table, EXPORTing the data, DROPping the...
0
by: Scott Van | last post by:
Hello- I am trying to create an Access table using DDL that has a memo field. I have the syntax to create the memo field but I can't find the syntax to also set whether the memo field should...
7
by: Matt | last post by:
Have below code AcctNbr give me result of 30. That is the database column length, Column stores 10 why is giving me 30 ? while(objRead.Read()) { AcctNbr = (string)objRead.ToString().Length;...
1
by: miqbal | last post by:
How can I loop through the columns collection in client side javascript? Or how can I get a column by the key, not just by the index in the collection? in Infragistics webgrid Thanks
6
by: Aaron Smith | last post by:
Is there a way to put a limit on the text size of a datagrid column? Thanks, Aaron -- --- Aaron Smith Remove -1- to E-Mail me. Spam Sucks.
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
1
by: AR123 | last post by:
Hi I want to set up a rotating banner. Not sure how to incorporate my rotating banner code into the code below. I want the rotating banner to be the main feature image? This is set up in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.