0
I created a default value for my database:
CREATE DEFAULT [dbo].[zero] as 0
But I cannot create a table using this default value created. How do I set this value when creating a table? For example:
CREATE TABLE TESTE ( num int DEFAULT zero)
0
I created a default value for my database:
CREATE DEFAULT [dbo].[zero] as 0
But I cannot create a table using this default value created. How do I set this value when creating a table? For example:
CREATE TABLE TESTE ( num int DEFAULT zero)
1
You can set the value default field "num" when creating the TEST table like this:
CREATE TABLE TESTE
(
num int DEFAULT (0)
)
This "CREATE DEFAULT" feature will be removed in a future version of Microsoft SQL Server in accordance with msdn, then it’s good to avoid it.
Browser other questions tagged sql sql-server sql-server-2008
You are not signed in. Login or sign up in order to post.
So, but the idea would be to take advantage of the default zero for other tables as well, then if I ever wanted to change the value I would change the default and this would replicate for all tables. The zero in this case was more of an example, but it was worth.
– Murilo Fechio