Solved

stored procuder to insert values into a table, some values can be given and some will be from anoter table

Posted on 2011-09-22
4
234 Views
Last Modified: 2012-05-12
Hi,
I want a stored procedure to insert values into a table, i will give some values through parameters and some of the values should get from another table. How can I get this? please help me.
Thanks in advance.
0
Comment
Question by:CPSRI
  • 2
4 Comments
 
LVL 15

Assisted Solution

by:Eyal
Eyal earned 250 total points
ID: 36579714
insert into table (f1,f2)
select @parameter,field from table where ...
0
 
LVL 6

Accepted Solution

by:
kswathi earned 250 total points
ID: 36579720
You can do so as  following hope it helps

Insert into [yourtable1]
(
Col1,
Col2,
col3
)
Select @Parameter1,
          @parameter2,
         AT.Col1
from anothertable AT

Open in new window

0
 

Author Comment

by:CPSRI
ID: 36579846
got it, thank you Eyal and kswathi for your help, i got to use where condition as per my requirement and i tried that and got the solution
0
 

Author Closing Comment

by:CPSRI
ID: 36579850
got it, thank you Eyal and kswathi for your help, i got to use where condition as per my requirement and i tried that and got the solution
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to check data in sql table 11 51
format nvarchar field as mm/dd/yyyy 4 78
MessageHandler Database in SQL way too large 4 47
Sql Server group by 10 43
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question