|
Home > Archive > MS SQL Server > March 2006 > q: generate insert and update
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
q: generate insert and update
|
|
| JIM.H. 2006-03-13, 8:23 pm |
| Hello,
I have too many columns in my table and I am looking for a way to generate
insert and update statements automated. I tried SqlDataAdapter, it fails. Any
help will be greatly appreciated.
| |
|
| Something like that:
Creating an autocontained SELECT in order to generate a DML instructions
intended
SELECT 'insert into tabletest(a,b)
values (' + convert(varchar(10),
a) + ',
' + convert(varchar(160)
,b) + ' )'
FROM
tabletest
--
current location: alicante (es)
"JIM.H." wrote:
> Hello,
> I have too many columns in my table and I am looking for a way to generate
> insert and update statements automated. I tried SqlDataAdapter, it fails. Any
> help will be greatly appreciated.
>
>
| |
| JIM.H. 2006-03-14, 9:23 am |
| Hi Eric,
Thank you very much for your reply. I am just trying to generate my insert
and update statements instead of typing all the filed names manually, is this
possible?
"Enric" wrote:
[color=darkred]
> Something like that:
> Creating an autocontained SELECT in order to generate a DML instructions
> intended
> SELECT 'insert into tabletest(a,b)
> values (' + convert(varchar(10),
a) + ',
> ' + convert(varchar(160)
,b) + ' )'
> FROM
> tabletest
>
>
>
> --
> current location: alicante (es)
>
>
> "JIM.H." wrote:
>
| |
| KBuser 2006-03-14, 11:23 am |
| You probably could have typed all the field names twice over with the
time and effort you put into creating that post.... Is it just me, or
are people getting really lazy?
| |
| Hugo Kornelis 2006-03-15, 8:23 pm |
| On Tue, 14 Mar 2006 06:19:50 -0800, JIM.H. wrote:
>Hi Eric,
>Thank you very much for your reply. I am just trying to generate my insert
>and update statements instead of typing all the filed names manually, is this
>possible?
Hi Jim,
If you're writing queries in Query Analyzer, you can open the Object
Explorer (hit the F8 key), then use drag and drop to paste a complete
column list in the query you're writing.
--
Hugo Kornelis, SQL Server MVP
|
|
|
|
|