473,385 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Ms Sql Stored Procedure

hi friends this is Ram
I m making a Project On VB6.0
On Worker Details for a company
I want to create automatic worker Id Generate
what i do,
I create a stored procedure for this problem
but there are a errer when i exec my stored procedure
my table and Proce are give following
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\
create table worker
(
wid char(5),
wfname varchar(15),
wlname varchar(15),
wdobirth varchar(10),
wgender char(8)
)
select * from worker
insert into worker values('W00','Ram','Yadav','23/03/1987','M')
create procedure prcWorker
@incre int output
as
declare @wid char(5)
select @wid = max(wid) from worker
select @incre = convert(int,substring(@wid,2,4)) + 1 return

ERROR://Procedure or Function 'prcWorker' expects parameter '@incre', which was not supplied.//

Please Help Me Immediate ,Please
and Please give me solution on My e-mail id raj_sargum@rediff.com
which one i m using always.
Please Help me ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Regard's Ram Yadav (India)
Nov 26 '07 #1
2 1498
QVeen72
1,445 Expert 1GB
Hi Ram,
Some Syntax roblem with Creation of your stored procedure..
Try This :

Expand|Select|Wrap|Line Numbers
  1. CREATE PROCEDURE prcWorker (OUT incre INT)
  2. BEGIN
  3. declare @wid char(5);
  4. select @wid = max(wid) from worker;
  5. select incre = convert(int,substring(@wid,2,4)) + 1;
  6. END;
  7.  
I guess, all the statements should end with a semi-colon..

REgards
Veena
Nov 26 '07 #2
Kabyr
29
I guess instead of writing a sored SQL procedure, u could read you last ID into a variable and then increment before saving back to table.
Like:
dim WID as integer, newid as integer
Dim urRS
urRS.open querry
urRS.movelast
WID=urRS("tablewid")
newid = wid+1
save newid into your table.

or

create a table to hold the last ID issued
read the id from the table, increment, save the value to warker's table, then updaate the lastid table with new id. ID table will have only 1 record.
Just use "update idtable set lastid = newid;"

either may help.
Nov 29 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
4
by: Rhino | last post by:
Is it possible for a Java Stored Procedure in DB2 V7.2 (Windows) to pass a Throwable back to the calling program as an OUT parameter? If yes, what datatype should I use when registering the...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
2
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.