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.
| Author |
Topic |
|
devikamesh
Starting Member
2 Posts |
Posted - 2011-06-23 : 05:25:40
|
| say i have employee table which has 4 field.1.empid2.empname3.gender4.DOBin my visual studio while clicking add employee with all these fields designed it should get inserted into database. i wrote a stored procedure like this. pls help whether am correct or not.create procedure prc_addemp(@empid int,@empname varchar(20),@gender varchar(10),@dob date,@status int output)asbegininsert into emp(empid,empname,gender,dob) values (@empid ,@empname,@gender ,@DOB)endgo. this query has executed. pls help me. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-06-23 : 05:46:17
|
the stored procedure looks ok. Except you didn't return any value to the @statusdo you get any error when execute the stored procedure ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
devikamesh
Starting Member
2 Posts |
Posted - 2011-06-23 : 05:49:39
|
| No i didnt get any errors. i execute procedure like this.declare @iRes intexec prc_addemp 100,'abcd','Female','01-03-1985',@iResselect @iResthe record is getting inserted into table but that iRes value showing as NULL. |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2011-06-23 : 10:27:25
|
quote: Originally posted by devikamesh the record is getting inserted into table but that iRes value showing as NULL.
That's because:quote: Originally posted by khtan Except you didn't return any value to the @status
create procedure prc_addemp(@empid int,@empname varchar(20),@gender varchar(10),@dob date,@status int output)asbegininsert into emp(empid,empname,gender,dob) values (@empid ,@empname,@gender ,@DOB); SET @status = ????end |
 |
|
|
|
|
|
|
|