If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > Adding a column to a database table

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-01-09, 10:11
xotesa xotesa is offline
Registered User
 
Join Date: Jun 2009
Posts: 16
Adding a column to a database table

Hello i want to add another bit column to my table.

Columns were

userID ---- userName

Now i want to add a column

userID ---- userName ---- isSuperUser


Now i have values in my table.

I want to add the column isSuperUser to my table and set old row's isSuperUser column to 1 ...


How can I achieve this?


Do i need to drop the table and create it again?
Reply With Quote
  #2 (permalink)  
Old 07-01-09, 10:38
aflorin27 aflorin27 is offline
Registered User
 
Join Date: Apr 2008
Location: Iasi, Romania
Posts: 304
Sybase documentation for ALTER TABLE:
SyBooks Online

datatype
is any system datatype except bit or any user-defined datatype except those based on bit.
__________________
Florin Aparaschivei
Iasi, Romania
Reply With Quote
  #3 (permalink)  
Old 08-27-09, 11:20
smart_DBA smart_DBA is offline
Registered User
 
Join Date: Aug 2009
Posts: 1
hello ,

you can using this command

1> alter table table name add isSuperUser datatype
2> go

then use this command

1> update table name
2> set isSuperUser=1
3> go



good luck

Last edited by smart_DBA; 08-27-09 at 11:32.
Reply With Quote
Reply

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On