A Microsoft Office (Excel, Word) forum. OfficeFrustration

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   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"...ADD COLUMN...DEFAULT YES" leaves existing rows as FALSE?



 
 
Thread Tools Display Modes
  #1  
Old July 2nd, 2005, 11:59 PM
Santiago
external usenet poster
 
Posts: n/a
Default "...ADD COLUMN...DEFAULT YES" leaves existing rows as FALSE?

Hi all,
I'm adding a new column via this statement:
ALTER TABLE myTable ADD COLUMN myColumn YESNO DEFAULT YES

And it works great except that existing rows have myColumn = FALSE even
though the default is TRUE (new rows behave correctly). I would expect that
existing rows would take on the default? Am I incorrect in my expectation or
is there something wrong in my SQL statement?

P.S.: If you were about to answer: Just use this statement:
UPDATE myTable SET myColumn = YES
save your breath I already have done that. The question above still
stands though.


Ads
  #2  
Old July 3rd, 2005, 03:03 AM
Allen Browne
external usenet poster
 
Posts: n/a
Default

The Default Value applies only to new records.

It never has an effect on existing records.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Santiago" replytonewsgroup wrote in message
...
Hi all,
I'm adding a new column via this statement:
ALTER TABLE myTable ADD COLUMN myColumn YESNO DEFAULT YES

And it works great except that existing rows have myColumn = FALSE even
though the default is TRUE (new rows behave correctly). I would expect
that
existing rows would take on the default? Am I incorrect in my expectation
or
is there something wrong in my SQL statement?

P.S.: If you were about to answer: Just use this statement:
UPDATE myTable SET myColumn = YES
save your breath I already have done that. The question above still
stands though.



  #3  
Old July 3rd, 2005, 07:30 AM
Santiago
external usenet poster
 
Posts: n/a
Default

Thanks Allen for taking the time to respond.

- Santiago

--
Santiago Palacios
Metalogic Software
www.metalogicsw.com
"Allen Browne" wrote in message
...
The Default Value applies only to new records.

It never has an effect on existing records.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Santiago" replytonewsgroup wrote in message
...
Hi all,
I'm adding a new column via this statement:
ALTER TABLE myTable ADD COLUMN myColumn YESNO DEFAULT YES

And it works great except that existing rows have myColumn = FALSE even
though the default is TRUE (new rows behave correctly). I would expect
that
existing rows would take on the default? Am I incorrect in my

expectation
or
is there something wrong in my SQL statement?

P.S.: If you were about to answer: Just use this statement:
UPDATE myTable SET myColumn = YES
save your breath I already have done that. The question above still
stands though.





 




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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
updating a column in existing excel sheet disgustipated Worksheet Functions 0 June 29th, 2005 08:44 PM
Lookup Table Dilemma Karen Worksheet Functions 2 June 10th, 2005 08:22 PM
generate multiple rows based on cell value Theresa Worksheet Functions 0 May 25th, 2005 11:18 PM
Deleting rows contains certain text in column A plumstone General Discussion 1 September 17th, 2004 08:05 PM
Deleting rows with no data using Auto Filter and Helper column John Worksheet Functions 1 April 19th, 2004 06:52 AM


All times are GMT +1. The time now is 01:54 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2004-2018 OfficeFrustration.
The comments are property of their posters.