Solved

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

Posted on 2012-04-12
1
258 Views
Last Modified: 2012-04-16
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
Comment
Question by:zimmer9
1 Comment
 
LVL 3

Accepted Solution

by:
john M earned 500 total points
ID: 37839890
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After having deployed hundreds of thousands of Terminal Services seats worldwide, I still see all the time people asking me that same old question: "If TS/RDS is that reliable why are you telling me I should reboot it that often? My DC/SQL/Exchange/…
Know what services you can and cannot, should and should not combine on your server.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question