for the following fields how would i write the update and delete query
ID int
R_ID int,
S_Name varchar(50),
Phone_No numeric,
Email varchar(50),
S_Subject varchar(50),
Marks numeric
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vinodh NarayananPosted Jan 5, 2015, 11:23 PM
Vinodh NarayananPosted Jan 5, 2015, 11:23 PM
Manish Kumar ChoudharyPosted Jan 5, 2015, 11:20 PM
Hi Faiza Saher,
For Update
Create PROCEDURE [dbo].[SpUpdate]
@ID int,
@R_ID int,
@S_Name varchar(50),
@Phone_No numeric,
@Email varchar(50),
@S_Subject varchar(50),
@Marks numeric
AS
Begin
UPDATE <TableName>
SET R_ID = @R_ID,
S_Name=@S_Name,
Phone_No=@Phone_No,
Email=@Email,
S_Subject=@S_Subject
Marks=@Marks
WHERE ID= @ID
End
For Delete
Create PROCEDURE [dbo].[SpDelete]
@ID int,
AS
Begin
DELETE FROM <TableName>
WHERE ID= @ID
End
Sushil GuptaPosted Jan 5, 2015, 12:14 PM
Delete from Employee where empID = 10;
It will delete entire row.
Update can be specific to column or set of column.
Syntax is
Update Table_Name Set col1 = "New Value",col2.....
Where some_condition.