Home > Archive > microsoft.public.sqlserver.server > November 2002 > How to create a insert script file (*.sql)?





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 How to create a insert script file (*.sql)?
Boah

2002-11-21, 11:24 am

Hello,

I have a table with data, now I want to create a *.sql file with all
the INSERT statements from this table.

How can I do that?

Thanks!
Steve Thompson

2002-11-21, 12:24 pm

"Boah" <boah123@hotmail.com> wrote in message
news:8202c755.0211210919.7254670b@posting.google.com...
> I have a table with data, now I want to create a *.sql file with all
> the INSERT statements from this table.
>
> How can I do that?


Consider using bcp (utility) to copy the data out and bcp to copy it back
in...

It works well and it's fast.

Steve


Quentin Ran

2002-11-21, 12:24 pm

Boah,

if you HAVE to create the script (not for the purpose of data transfer), one
way is that you can write a cursor which generates the statements with the
values from the table.

Quentin

"Boah" <boah123@hotmail.com> wrote in message
news:8202c755.0211210919.7254670b@posting.google.com...
> Hello,
>
> I have a table with data, now I want to create a *.sql file with all
> the INSERT statements from this table.
>
> How can I do that?
>
> Thanks!



Anith Sen

2002-11-21, 12:24 pm

Vyas has a decent script in his site:
http://vyaskn.tripod.com/code/generate_inserts.txt
You can also use:
http://www.rac4sql.com/objectscriptr_main.asp

--
- Anith




Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2008 examnotes.net