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
227 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Getting the 3 middle digits 4 37
How to check data in sql table 11 47
SQL Server Degrading on Write 13 67
Bubble user-defined Sql RAISERROR(...) to c# exception 14 168
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 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