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 2008 Forums
 Transact-SQL (2008)
 unable to stored procedure

Author  Topic 

strajan2012
Starting Member

3 Posts

Posted - 2011-12-12 : 01:26:21
Actually below is my stored procedure:
ALTER PROCEDURE SP_INSERT_LOGIN2
(
@SNO1 INT OUTPUT
@TIME1 VARCHAR(24)OUTPUT
@USERNAME VARCHAR(50)
@PASSWORD VARCHAR(50)
@CPASSWORD VARCHAR(50)
@EMAIL VARCHAR(50)
@SECQUEST VARCHAR(50)
@SECANSWER VARCHAR(50)
)
AS

begin
SELECT @SNO1=COUNT(*)+1 FROM AL_TBL_LOGIN
end
begin
SELECT @TIME1=CONVERT(varchar(24),CURRENT_TIMESTAMP,121)
end
-- Insert the record into the database
insert into AL_TBL_LOGIN
(DB_T_AL_SNO,
DB_T_AL_LOG_CREATE_TIME,
DB_T_AL_LOG_USR_NAME,
DB_T_AL_LOG_USR_PWD,
DB_T_AL_LOG_USR_CF_PWD,
DB_T_AL_LOG_USR_EMAIL,
DB_T_AL_LOG_USR_SEC_QUESTION,
DB_T_AL_LOG_USR_SEC_ANSWER
)
values(
@SNO1,
@TIME1,
@USERNAME,
@PASSWORD,
@CPASSWORD,
@EMAIL,
@SECQUEST,
@SECANSWER
)

I UNABLE TO USE THIS STORED PROCEDURE.pLEASE HELP ME IN CORRECT THIS



STR

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-12 : 01:30:00
what do you mean by unable to use? are you getting some errors while trying to execute this? where's the create part between? or is it already existing in db?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

strajan2012
Starting Member

3 Posts

Posted - 2011-12-12 : 03:37:22
quote:
Originally posted by visakh16

what do you mean by unable to use? are you getting some errors while trying to execute this? where's the create part between? or is it already existing in db?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

yes its already existing






STR
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-12-12 : 04:57:36
how about the other more important question that Visakh asked ?
quote:

1. what do you mean by unable to use?

2. are you getting some errors while trying to execute this?




KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-12-12 : 05:48:27
All parameters should be seperated by comma

ALTER PROCEDURE SP_INSERT_LOGIN2
(
@SNO1 INT OUTPUT,
@TIME1 VARCHAR(24)OUTPUT,
@USERNAME VARCHAR(50),
@PASSWORD VARCHAR(50),
@CPASSWORD VARCHAR(50),
@EMAIL VARCHAR(50),
@SECQUEST VARCHAR(50),
@SECANSWER VARCHAR(50)
)
AS

begin
SELECT @SNO1=COUNT(*)+1 FROM AL_TBL_LOGIN
end
begin
SELECT @TIME1=CONVERT(varchar(24),CURRENT_TIMESTAMP,121)
end
-- Insert the record into the database
insert into AL_TBL_LOGIN
(DB_T_AL_SNO,
DB_T_AL_LOG_CREATE_TIME,
DB_T_AL_LOG_USR_NAME,
DB_T_AL_LOG_USR_PWD,
DB_T_AL_LOG_USR_CF_PWD,
DB_T_AL_LOG_USR_EMAIL,
DB_T_AL_LOG_USR_SEC_QUESTION,
DB_T_AL_LOG_USR_SEC_ANSWER
)
values(
@SNO1,
@TIME1,
@USERNAME,
@PASSWORD,
@CPASSWORD,
@EMAIL,
@SECQUEST,
@SECANSWER
)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

johntech
Yak Posting Veteran

51 Posts

Posted - 2011-12-12 : 09:44:50
Ok i guess that you don't use the use statement at the above of stored procedure ,Or may be the stored is in use at the same time you made update
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-12-12 : 09:54:13
quote:
Originally posted by johntech

Ok i guess that you don't use the use statement at the above of stored procedure


No need is there? (Well, it will be created in CURRENT Database, which may not be the one the O/P intended ... but if you put a USE statement in the script then you will have to change that if you ever want to create the SProc in a different database. We don't bother, we just make sure the CURRENT Database is the one where we want to create it)

"Or may be the stored is in use at the same time you made update"

That's not a problem. Anyone currently executing that SProc will get the current "version", and then next person(s) will get the new version.
Go to Top of Page
   

- Advertisement -