, "" , -!
, MS SQL 2008 Express :
year(getdate()) + 1
SQL Server
(datepart(year,getdate())+(1))
, , 100% ,
1) , , , . , getdate() (0), (1). , .
2) , [] (), + 1, ([] + (1)). , .
3) , 1- 2- , , , - .
EDIT 04.Aug:
, . , ? , , , (, , )
/ , , # Microsoft.SqlServer.Management.Smo. IntTest int, VarcharTest varchar (1), DateTimeTest datetime .. - . / , drop , .
# ( Microsoft.SqlServer.Management.Smo;)
Server server = new Server("localhost\\SQLEXPRESS");
Database db = server.Databases["test"];
Table t = db.Tables["test_defaults"];
//here should be some logic to select column name depending on default data type
//for example for DateTime defaults we will use "DateTimeTest" column
Column c = t.Columns["DateTimeTest"];
//clean up previous results if they exist
DefaultConstraint constr = c.DefaultConstraint;
if (constr != null) constr.Drop();
//create new constraint
constr = c.AddDefaultConstraint();
constr.Text = "getdate()";
constr.Create();
//after refresh we will have a new text
constr.Refresh();
string result = constr.Text;
//drop it if we don't need it
constr.Drop();