| Author |
Message |
   
Gandhiguevara
Legend Username: Gandhiguevara
Post Number: 41758 Registered: 10-2009 Posted From: 142.136.137.10
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, October 24, 2013 - 08:59 pm: |
    |
Humpty_dumpty:
 |
   
Humpty_dumpty
Moderator Username: Humpty_dumpty
Post Number: 23682 Registered: 02-2009
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, October 24, 2013 - 05:04 pm: |
    |
Ok got it Thanks ee |
   
Casino
Side Hero Username: Casino
Post Number: 2846 Registered: 01-2012 Posted From: 198.46.98.226
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, October 24, 2013 - 05:02 pm: |
    |
Humpty_dumpty:I know update and add works Wanted to know if there is a way to combo
alter table is a DDL, not DML. so you can one at a time guru |
   
Humpty_dumpty
Moderator Username: Humpty_dumpty
Post Number: 23681 Registered: 02-2009
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, October 24, 2013 - 04:59 pm: |
    |
I know update and add works Wanted to know if there is a way to combo |
   
Casino
Side Hero Username: Casino
Post Number: 2845 Registered: 01-2012 Posted From: 198.46.98.226
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, October 24, 2013 - 04:40 pm: |
    |
ALTER TABLE TTTT ADD CONSTRAINT TTT_test DEFAULT 1 FOR b; |
   
Dreamcatcher
Side Hero Username: Dreamcatcher
Post Number: 4723 Registered: 11-2009 Posted From: 208.86.145.68
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, October 24, 2013 - 04:40 pm: |
    |
Idi try seyyi veelaithay.... ALTER TABLE <schema_name,>.<table_name,> ADD CONSTRAINT df_<column_name,> DEFAULT <default_expression,> FOR <column_name,> GO If you need to add a foreign key ALTER TABLE Products WITH CHECK ADD CONSTRAINT [FK_Prod_Man] FOREIGN KEY(ManufacturerID) REFERENCES Manufacturers (ID); |
   
Casino
Side Hero Username: Casino
Post Number: 2844 Registered: 01-2012 Posted From: 198.46.98.226
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, October 24, 2013 - 04:37 pm: |
    |
update existing rows with default value before altering |
   
Buduguuu
Hero Username: Buduguuu
Post Number: 15781 Registered: 01-2012 Posted From: 192.193.171.158
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, October 24, 2013 - 04:37 pm: |
    |
including existing rows enti?? meeru value iyyakapote column lo 1 raavali. ade na mee badha? adi table level lo column meeda define cheste saripoddi kada? btw, nenu oracle perspective lo cheppanu. sql server diff aite telvadu naku mari  Different cinema ante Dabangg/GS/CE Biryani about Mahesh Babu |
   
Humpty_dumpty
Moderator Username: Humpty_dumpty
Post Number: 23680 Registered: 02-2009
Rating: N/A Votes: 0 (Vote!) | | Posted on Thursday, October 24, 2013 - 04:25 pm: |
    |
if pazibul help seyyandi create table #ttt ( a int, b bit null) insert into #ttt values (1, null) insert into #ttt values (2, 1) insert into #ttt values (3, 0) select * from #ttt I want to add a constraint on column b - to have a default value of 1, including existing rows. ALTER TABLE #ttt ADD CONSTRAINT [DF_b] DEFAULT ((1)) FOR [b] WITH VALUES DOES NOT work |