How to add a Single value as a Record add and update

Posted by Self-innovator under Sql Server category on | Points: 40 | Views : 1397
Store procedure to add a single record it helps in terms of Contact Us where user will not enter more than one record in a table contact
create proc [dbo].[sp_ContactUs]
@desc varchar(MAx)
declare @temp as int
set @temp=(select count(*) from ContactUs)
if @temp=0
insert into ContactUs values(1,@desc)
update ContactUs set Descriptionn=@desc where id=1

Comments or Responses

Posted by: T.saravanan on: 12/26/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
What is the purpose of this code?

Posted by: Self-innovator on: 12/27/2011 Level:Bronze | Status: [Member] | Points: 10
storing only 1 record in a table
Posted by: T.saravanan on: 12/28/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
I know. Why we store only one record in a table? Can you explain?

Kindly post your code inside the code tag.
Posted by: Self-innovator on: 1/1/2012 Level:Bronze | Status: [Member] | Points: 10
In contact us page where we can have only one record...

Login to post response