Wednesday, March 7, 2012

define a default value ?

hallo

i am on the very beginning with sql.s,

how can i define a default value for the table field like its possible in access,

for example: the if the user not gonna enter a val so there is a default val predefined in the table field,

for example i would like to predefine the date now on the smalldate field....

thanks

maybe something like:

Code Snippet

create table dbo.yourTable

( anInteger int default (0)

)

Give a look to books online.

|||

so if i would like to predefine the date now on the smalldate field its will look like this

table dbo.myTable

( anInteger smalldate default (0)=new

)

|||

No, that would be more like:

createtable dbo.myTable

( anInteger smalldate default ( getdate() )

)

|||thanks

No comments:

Post a Comment