|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, November 17, 2008 4:47 AM
Points: 15,
Visits: 49
|
|
How can i write a store procedure in sql server to update a particular row of a table. For Example i have a table name Emplyee which have column empid ,name ,salary. Now the data are as
empid name salary 1 a 1000 2 b 2000
so how can i update the row of empid of 2
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 2:54 AM
Points: 1,076,
Visits: 5,128
|
|
Example:
create procedure spEmployeeUpdate ( @EmpId integer, @Name char(75), @Salary decimal(8, 2) ) as update employee set [name] = @Name, Salary = @Salary where empid = @EmpId
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, November 17, 2008 4:47 AM
Points: 15,
Visits: 49
|
|
| thanks if the empid is automatically generated no then is it same
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 2:54 AM
Points: 1,076,
Visits: 5,128
|
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, November 17, 2008 4:47 AM
Points: 15,
Visits: 49
|
|
thanks now if i have another table name empadd where i have to update at the same time and whose fields are
EaddID address empid 1 abc 1 2 asd 2
then what will be the change here empid of empadd is foreign key of the table emplyee
|
|
|
|