Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Assigning default value to User Defined DataType
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
Application:
Desktop
Divers
Thread ID:
01418922
Message ID:
01418971
Vues:
30
>>>>I am having trouble assigning a default value to a user defined data type in code.
>>>>I can create the default object using
>>>>CREATE DEFAULT DEFAULTZERO as 0
>>>>and I can create the datatype using
>>>>CREATE TYPE Logical FROM bit NOT NULL
>>>>but I can't seem to get the right binding syntax for assigning DefaultZero as the default object for Logical.
>>>>I can do it manually through SQL Studio
>>>>TIA
>>>>Trevor
>>>
>>>Here the script SSMS generated:
>>>
>>>USE [Test]
>>>GO
>>>CREATE TYPE [dbo].[Logical] FROM [bit] NOT NULL
>>>GO
>>>EXEC sys.sp_bindefault @defname=N'[dbo].[DefaultZero]', @objname=N'[dbo].[Logical]' , @futureonly='futureonly'
>>>GO
>>>
>>Thanks Borislav
>>SSMS didn't generate the exec statement for me.
>
>Which SQL Server version you're using? Go to Tools/Options/SQL Server Object/Scripting and examine the settings there.
The script is supposed to be version independent but the test was run on a basic install of SQL2008.
Thanks
Trevor
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform