Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 9th, 2007, 02:35 PM
cryptos cryptos is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 3 cryptos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 34 sec
Reputation Power: 0
Alter field type problem

I need to alter a filed of type VARCHAR(3000) to VARCHAR (100)

ALTER TABLE PREGLED ALTER COLUMN NOMER TYPE VARCHAR(100); - is returning "Unsuccessful metadata update.
New size specified for column NOMER must be at least 3000 characters.
"

Is it possible?

Greets.

Reply With Quote
  #2  
Old January 10th, 2007, 01:56 AM
upscene upscene is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 223 upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 14 m 50 sec
Reputation Power: 8
No, it isn't. You cannot make a field smaller than it's original size.

Make sure the field has no dependencies (eg: indices, constraints, stored procedures) and then do the following:

- create a new field with the new size (alter table mytable add newfield varchar(100) )
- update mytable set newfield = oldfield
- drop the old field
- rename the newfield to the oldfield name

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle & MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
Comments on this post
pabloj agrees!
__________________
Martijn Tonies
Database Workbench: developer IDE for Firebird, MySQL, InterBase, MSSQL Server and Oracle
Upscene Productions
http://www.upscene.com

Reply With Quote
  #3  
Old January 10th, 2007, 08:43 AM
cryptos cryptos is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 3 cryptos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 34 sec
Reputation Power: 0
It worked. Thanks!

Greets.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Alter field type problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway