Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to force alter-column 2

Status
Not open for further replies.

Ovatvvon

Programmer
Joined
Feb 1, 2001
Messages
1,514
Location
US
I am trouble shooting a script for someone else where they used an alter column statement to change from a varchar(100) to a varchar(25). Query Analyzer will not execute the command because there is text inside the column that is longer than 25 char's.

Is there a way to not check for that, or to have it execute the change regardless of whether the text will be truncated or not?


-Ovatvvon :-Q
 
If you really want to truncate the data, you could do that before altering the column.


[tt][blue]Update Table
Set Field = Left(Field, 25)[/blue][/tt]


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
There are multiple statements like this, and it'd be nice to run them together. There is no way to just force it to truncate anything it needs to?


-Ovatvvon :-Q
 
Nope.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005) / MCITP Database Administrator (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Bummer. Thanks for the info though.

-Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top