Bogdan M.
Bogdan M.

Reputation: 2181

Create new table procedure

I'm trying to create a procedure which adds / removes a table to the database. I'm working in SQL Server. The query works (it succeeds) but the table isn't added to the database.

I did refreshed...

ALTER procedure [dbo].[upgrade_1]
as
begin
    create table awards (
    ID int NOT NULL IDENTITY,   
    name nvarchar(256) DEFAULT 'award',
    description nvarchar(256)
    PRIMARY KEY (ID)
    )
    /*update goto_vs
    set current_version = 1*/
end

Upvotes: 0

Views: 64

Answers (1)

codingbiz
codingbiz

Reputation: 26386

The script you have in the question will only modify the PROCEDURE. The procedure needs to be executed for it to perform the required task e.g. create the table

Execute the procedure with this statement

EXEC upgrade_1

That should create the table

Upvotes: 1

Related Questions