?
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
Medium Priority
?
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 15

Assisted Solution

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

Accepted Solution

by:
kswathi earned 1000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

762 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