Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Add a default to a column Expand / Collapse
Author
Message
Posted Thursday, March 17, 2011 10:15 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 8:46 AM
Points: 33,200, Visits: 15,343
Show in SSMS and T-SQL, how to add a default to a column at design time (CREATE) and later (ALTER).

Be nice to add these defaults

space for char field
0 for numeric
current date for date field







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1079835
Posted Thursday, March 17, 2011 10:29 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, August 5, 2014 7:36 AM
Points: 377, Visits: 3,063
Hi Steve

I'll take this.

Regards
Post #1079846
Posted Thursday, March 17, 2011 10:50 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 8:46 AM
Points: 33,200, Visits: 15,343
Excellent, this should be an easy one.






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1079861
Posted Friday, July 29, 2011 9:08 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, August 5, 2014 7:36 AM
Points: 377, Visits: 3,063
Hi Steve

I'm going to have to pass on this. Workload means I don't currently have time to write an article that adds any value compared to what is already out there. Sorry. I've submitted a QOTD instead as penance.

Anybody else able to do this?
Post #1151019
Posted Friday, July 29, 2011 9:23 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 8:46 AM
Points: 33,200, Visits: 15,343
No worries, we'll find someone else.






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1151030
Posted Tuesday, November 29, 2011 7:01 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 10:11 AM
Points: 36,992, Visits: 31,513
Since this is very well documented in Books Online, I have to ask, do you still want an article on this and, if so, should it be more of a "Spackle" article?

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1213635
Posted Tuesday, November 29, 2011 9:32 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 8:46 AM
Points: 33,200, Visits: 15,343
Yes, and Yes. We want to expand and cover things that are in BOL in a different way. A practical use for this in a short article that someone has implemented in production would be nice.






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1213658
Posted Wednesday, November 30, 2011 6:09 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 10:11 AM
Points: 36,992, Visits: 31,513
Steve Jones - SSC Editor (11/29/2011)
Yes, and Yes. We want to expand and cover things that are in BOL in a different way. A practical use for this in a short article that someone has implemented in production would be nice.


Understood and can do. I'll take this one on. Thank you for the guidance.

I believe I still owe you one on getting BCP (and other methods) to produce column headers, as well. I'll see what I can do about that, as well.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1213868
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse