?
Solved

generate insert statement with data dynamically

Posted on 2008-06-25
1
Medium Priority
?
203 Views
Last Modified: 2010-03-19
I have a table:A  that has 50 rows...

Id   code number
12   A      789
13   B      767
34   T      890
--- etc


I am trying to generate  50 insert statements with data in that table dynamically without typing 50 insert statement with data...

insert into test ( ID, code, number) values ( 12,'A', 787)
-- etc



How can i do this?
0
Comment
Question by:jung1975
[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 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 21867080
Hello jung1975,

SELECT 'Insert into test (id, code,number)  select '+ CAST(id AS varchar) +' , ''' +code+''','+ CAST (number AS varchar)
FROM urTable

GOD BLESS,

Aneesh R.
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

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