[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

I execute a stored procedure in Microsoft SQL Server Management Studio 2005 and I don't know why the table doesn't get created?

I execute the following stored procedure in Microsoft SQL Server 2005.

I don't know why the table doesn't get created.

I use 'dbo' as the owner for the stored procedure and "empdwmsq" as the owner for the tables.
-------------------------------------------------------------
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

CREATE procedure [dbo].[sp_action_group]
As

If  Exists(SELECT * FROM dbo.SYSOBJECTS WHERE NAME = 'tblAction_Grp' AND TYPE = 'U')
DROP TABLE empdwmsq.tblAction_Grp

create table empdwmsq.tblAction_Grp
(PRINCIPAL_GROUP_TYPE varchar(255),
 PRINCIPAL_GROUP_VALUE varchar(255),
 ELEMENT_TYPE_VALUE_PAIRS varchar(255)
)

insert into empdwmsq.tblAction_Grp (PRINCIPAL_GROUP_TYPE,PRINCIPAL_GROUP_VALUE,ELEMENT_TYPE_VALUE_PAIRS)
values ('RIGHTS', 'Everything', NULL);
insert into empdwmsq.tblAction_Grp (PRINCIPAL_GROUP_TYPE,PRINCIPAL_GROUP_VALUE,ELEMENT_TYPE_VALUE_PAIRS)
values ('RIGHTS', 'Security Administrator', NULL);
insert into empdwmsq.tblAction_Grp (PRINCIPAL_GROUP_TYPE,PRINCIPAL_GROUP_VALUE,ELEMENT_TYPE_VALUE_PAIRS)
values ('RIGHTS', 'User', NULL);
insert into empdwmsq.tblAction_Grp (PRINCIPAL_GROUP_TYPE,PRINCIPAL_GROUP_VALUE,ELEMENT_TYPE_VALUE_PAIRS)
values ('RIGHTS', 'View', NULL);
0
zimmer9
Asked:
zimmer9
1 Solution
 
john MCommented:
i think it  cause you only created it and not ran it

CREATE procedure [dbo].[sp_action_group]
create the proc

alter procedure [dbo].[sp_action_group]
will run the proc
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now