how to set column width in Sybase

vinit kumar
vinit kumar used Ask the Experts™
on
Hello Experts

How to set the column width in sybase databse.I am looking for alternative of oracle alternative "column <column name> format a<width>" in Sybase.

Vinit kumar
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Database Expert
Awarded 2016
Top Expert 2016
Commented:
Looks like do you want to change the width of the column. For that you need to use the Alter command like below.

ALTER TABLE yourtableName
MODIFY ColumName VARCHAR(20)

Author

Commented:
Thanks Pawan for reply
Changes using above command is temporary or permanent.?
I mean changes in width value will be lost as soon as I logout from sybase?
Pawan KumarDatabase Expert
Awarded 2016
Top Expert 2016

Commented:
Changes will be permanent.

Author

Commented:
Pawan,what will be the command for session specific setting as I don't want to change data default settings.
I need environment setting for so that output is displayed in good format.
Shery VijayanSenior Database administration support analyst

Commented:
you can use left or right function or both  and specify the number of characters returned in the query  ..
or  try  using the sp_autoformat stored procedure provided by sybase .

sp_autoformat will dynamically resize columns  wrt to the largets value   ..
performance may be a concern if processing large result sets ..
Pawan KumarDatabase Expert
Awarded 2016
Top Expert 2016
Commented:
>> What will be the command for session specific setting as I don't want to change data default settings.
This is not session specific.  You can do changes for session in the SQL query. and that will not change the column size.
Pawan KumarDatabase Expert
Awarded 2016
Top Expert 2016

Commented:
Question abandoned.
Provided solution.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial