Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
T-SQL (SS2K8)
»
Can i use Default in Alter Statements
Can i use Default in Alter Statements
Rate Topic
Display Mode
Topic Options
Author
Message
Pulivarthi Sasidhar
Pulivarthi Sasidhar
Posted Tuesday, April 20, 2010 12:42 AM
SSC Eights!
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 5:30 AM
Points: 870,
Visits: 522
hi,
I am having a table. which is taking by default NULL values...
Now i want to update the Column default to'XXXX'
Script:-
CREATE TABLE [dbo].[Testowners](
[owner_id] [int] NULL,
[owname] [varchar](15) NULL
)
Alter Script 1:-
ALTER TABLE Owners
ALTER Column [owner_id] INT NOT NULL
Alter Script 2:-
ALTER TABLE Owners
ALTER Column owname VARCHAR(35) Default 'XX'
The first Alter Statement is working fine.
Cant i use the Default in Alter statement ....
Thnaks in advance.......
Post #906571
Pulivarthi Sasidhar
Pulivarthi Sasidhar
Posted Tuesday, April 20, 2010 12:54 AM
SSC Eights!
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 5:30 AM
Points: 870,
Visits: 522
I got solution.........
ALTER Table Owners
ADD CONSTRAINT con_owname DEFAULT 'XXX' FOR owname
But Y dont we use Default in the Alter statement. Event the below link shows it in Syntax...by SET Default...
http://msdn.microsoft.com/en-us/library/ms174123.aspx
Post #906576
Paul White
Paul White
Posted Tuesday, April 20, 2010 5:43 AM
SSChampion
Group: General Forum Members
Last Login: Today @ 4:22 PM
Points: 10,990,
Visits: 10,542
That is the Books Online entry for SQL Server Compact 3.5 Service Pack 1.
You want the SQL Server 2008 entry:
http://msdn.microsoft.com/en-us/library/ms190273.aspx
Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #906727
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.