Q: Table creation Error-- Create Table has by default error I have a ORG_TOOLS table contains a list of ToolIds and Status values for each unique OrgId. The stored procedure sp_ORG_ORGANIZATIONS_CreateDefaultTools copies the defaults from OrgId = 0 to a newly specified OrgId. It has been noted that during this process, no matter what the default Status values are, the ToolIds for the newly specified OrgId always have a status of 1.
CREATE TABLE [dbo].[ORG_TOOLS]
(
     [OrgId] [int] NOT NULL, 
     [ToolId] [int] NOT NULL, 
     [Status] [bit] NOT NULL 
         CONSTRAINT [DF_ORG_TOOLS_Status] DEFAULT ((1)) 
)


CREATE PROCEDURE dbo.sp_ORG_ORGANIZATIONS_CreateDefaultTools
    @OrgId INT
AS 
    SET NOCOUNT ON 

    INSERT INTO ORG_TOOLS (OrgId, ToolId)     
        (SELECT @OrgId, ToolId 
         FROM ORG_TOOLS  
         WHERE OrgId = 0) 
GO


A: Your code provides the answer - you are setting a default for the field of 1, and in your stored procedure you are not overriding this value. If you want to have a different value stored, you will need to pass that value in. You should also have a new line for the INSERT
INSERT INTO ORG_TOOLS (
    OrgID, 
    ToolID,
    Status
)
(SELECT 
    @OrgId, 
    ToolId,
    [[insert some status value here - perhaps you want a case statement or something, but you have to provide some value to override the default]]
FROM 
    ORG_TOOLS 
WHERE 
    OrgId = 0)  

