Click here to Skip to main content
14,937,132 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
i want to add data on one table having 3 column
for first two coulumn i have to add data from antother table tht i did
bt for third column i want to insert value from textbox on my application

hope u all understand my problem
thnks in advance
Posted

You should create unique key for the combinations two columns in that table
and using those two values you can update the third column of that particular row using Update[^] statement.
   
Comments
Tom Marvolo Riddle 4-Feb-14 5:35am
   
My 5!
Karthik_Mahalingam 4-Feb-14 5:55am
   
Thanks Jas:)
SQL
CREATE Procedure Proc_Demo
@Val VARCHAR(50)
AS
BEGIN
Insert Into Table1 (Value1,Value2,Value3)
(Select V1,V2,@Val  From Table2)

END



Referer this code it will help ou
   
Dear frnds...i do smthng like

"insert into [learn].[dbo].[QAtbl](SID,Sname,Ques,Subject) SELECT [SID] ,[Sname],'"+s7+"','"+s6+"' FROM [Learn].[dbo].[StdDetail] where Username='"+s3+"'";

in that S7 and S6 are my text box in apllication...

thnks frnds...
   
SQL
Dear frnds...i do smthng like

"insert into [learn].[dbo].[QAtbl](SID,Sname,Ques,Subject) SELECT [SID] ,[Sname],'"+s7+"','"+s6+"' FROM [Learn].[dbo].[StdDetail] where Username='"+s3+"'";

in that S7 and S6 are my text box in apllication...

thnks frnds...
   
HI Bhushan,


You cann't insert data into third column, you can only update it using primary key.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900