Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 table data not appearing

Author  Topic 

marioo
Starting Member

2 Posts

Posted - 2009-09-01 : 16:24:06
Hi there
Hopefully I'm in the right location with a not-too-newbie question and making sense and have provided enough information.
I have the stored procedure below. When I execute I get the "Command(s) completed successfully." message but there is nothing written to the table.



USE [DATABASE_NAME]
GO
/****** Object: StoredProcedure [dbo].[InputEmail_Info] Script Date: 09/01/2009 13:19:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[InputEmail_Info]


AS

DECLARE @Category varchar(15)
DECLARE @CommenterName varchar(50)
DECLARE @Email varchar(50)
DECLARE @Phone varchar(10)
DECLARE @RegistrationNo varchar(7)
DECLARE @CompanyName varchar(50)
DECLARE @Status varchar(10)
DECLARE @Comment varchar(max)
--DECLARE @CreateDate (smalldatetime)

INSERT INTO WebComments (Category, CommenterName, Email, Phone, RegistrationNo, CompanyName, Status, Comment, CreateDate)


VALUES ('Sales', 'Veronica Flowers', 'vflowers@misc.com', '987-321-6545', '516219', 'WonderY', 'Y', 'lots of content here', '12/12/2009' )


what am I missing? what am I doing wrong?
thank you for your help!

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-09-01 : 16:38:14
When you execute the code above, you are CREATING THE stored procedure only.
You don't execute the code within the stored procedure.

EXEC [dbo].[InputEmail_Info]

And now check WebComments table.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2009-09-01 : 16:45:10
I believe you want something like.

ALTER PROCEDURE [dbo].[InputEmail_Info]
@Category varchar(15)
, @CommenterName varchar(50)
, @Email varchar(50)
, @Phone varchar(10)
, @RegistrationNo varchar(7)
, @CompanyName varchar(50)
, @Status varchar(10)
, @Comment varchar(max)
AS


INSERT INTO WebComments (Category, CommenterName, Email, Phone, RegistrationNo, CompanyName, Status, Comment, CreateDate)
VALUES ('Sales', @CommenterName, @Email,@Phone, @RegistrationNo, @CompanyName, @Status, @Comment, getdate() )

go


Then to run you would just use something like

Exec [dbo].[InputEmail_Info] 'John Doe', 'JohnDoes@nothing.com','555-555-5555','MyCompany','Y','This is my Comment'



Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page

marioo
Starting Member

2 Posts

Posted - 2009-09-01 : 17:06:56
Hi,
Oh, thank you for getting back to me.
Beautiful, beautiful, beautiful --
thanks a lot
marioo
Go to Top of Page
   

- Advertisement -