Welcome to Dream.In.Code
Become an Expert!

Join 150,222 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,203 people online right now. Registration is fast and FREE... Join Now!




error on my Stored procedure

 
Reply to this topicStart new topic

error on my Stored procedure

cimpercee
14 Nov, 2007 - 06:55 AM
Post #1

D.I.C Head
**

Joined: 10 Aug, 2006
Posts: 127


My Contributions
i made a table on sql 2005.


table contains
userID as Int (primary key set for incremental)
userName as Text
userAddres as Text

my first SP seems fine.

create procedure sp_selectalluser

as

Select * from Users

exec sp_selectalluser

2nd has these error Msg 102, Level 15, State 1, Procedure sp_adduser, Line 3
Incorrect syntax near '@userName'.
Msg 137, Level 15, State 2, Procedure sp_adduser, Line 10
Must declare the scalar variable "@userID".


my second sp is


SQL
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[sp_adduser]
@userID int
@userName text
@userAddress text


as insert into Users (userID, userName, userAddress)
values (@userID, @userName, @userAddress)

exec sp_adduser


This post has been edited by PsychoCoder: 14 Nov, 2007 - 08:49 AM
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Error On My Stored Procedure
14 Nov, 2007 - 08:49 AM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Change your stored procedure to

SQL
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[sp_adduser]
@userID int,
@userName text,
@userAddress text
as insert into Users (userID, userName, userAddress)
values (@userID, @userName, @userAddress)


You didn't have commas "," between the variables in the signature of your stored procedure smile.gif

Hope that helps
User is offlineProfile CardPM
+Quote Post

cimpercee
RE: Error On My Stored Procedure
14 Nov, 2007 - 08:56 AM
Post #3

D.I.C Head
**

Joined: 10 Aug, 2006
Posts: 127


My Contributions
QUOTE(PsychoCoder @ 14 Nov, 2007 - 09:49 AM) *

Change your stored procedure to

SQL
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[sp_adduser]
@userID int,
@userName text,
@userAddress text
as insert into Users (userID, userName, userAddress)
values (@userID, @userName, @userAddress)


You didn't have commas "," between the variables in the signature of your stored procedure smile.gif

Hope that helps


yeah, it make sense now. thank you for the help.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 05:46AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month