?
Solved

Loop through SQL table.

Posted on 2007-04-10
1
Medium Priority
?
2,983 Views
Last Modified: 2008-04-16
Hi Guys
I think what I am asking is simple.
But I can not work it out.

I have a Microsoft SQL table.
It is one column. Example below.

Product
-------------
Microsoft XP.
Windows 2003
Micrososoft SQL 2003.

I need to pick each Product and insert into another table.

An example of the insert statement : Insert into Accepted_ Products(Client_Id,ContactNumber,Product)
                                                            Values ('022222222',2,'Microsoft XP')

I need to loop through Product table replacing Product with next item.

Any help highly appreciated




0
Comment
Question by:Shezad Ahmed
[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
1 Comment
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 375 total points
ID: 18884728
something like this:
insert into accepted_products (Client_Id,ContactNumber,Product)
select ('022222222',2, product from yourtable
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

752 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