Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Exporting table data with INSERT statements

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-09-04 : 08:07:41
Evagoras writes "How is this possible, if ever? We would like to be able to export "SQL INSERT" code for just the data in a table - not the table structure. The reason why a DTS would not work for us is that we want to have control over the identities. Auto-incrementing on the target, or replacing the values is simply not acceptable in our case becase those values are used somewhere else. We want the SQL code so that we can do a simple search and replace for the ids in the code and then run it in another database.

We could not find how to do this with Enterprise Manager. Possible?"

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-09-04 : 08:30:36
You could use bcp. Look it up in the Books online.

You could also use one of the data-scripting tools like the one from www.lockwoodtech.com

Owais


Make it idiot proof and someone will make a better idiot
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-09-04 : 10:55:24
quote:
Originally posted by AskSQLTeam

We would like to be able to export "SQL INSERT" code for just the data in a table - not the table structure.



Owais...you understood that?

quote:

The reason why a DTS would not work for us is that we want to have control over the identities. Auto-incrementing on the target, or replacing the values is simply not acceptable in our case becase those values are used somewhere else. We want the SQL code so that we can do a simple search and replace for the ids in the code and then run it in another database.



Search and replace Id's? Or do you mean the data for the id...if so why not use a trigger? a trigger will fire everytime data is added, change, and/or deleted...



Brett

8-)

SELECT @@POST=NewId()

That's correct! It's an AlphaNumeric!
Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2003-09-04 : 11:14:04
quote:
you understood that?


I assume that the poster is asking "how can I export a databases in the form of INSERT commands that I could run to get the exact same data into another database?".

With the exception that he has IDENTITY on the source, and wants to override the identity / populate non-identity columns at the destination.

-------
Moo. :)
Go to Top of Page

Wingenious
Starting Member

11 Posts

Posted - 2003-09-05 : 14:39:56
It sounds like new values are not desired and the original values are not desired. Can we find out what "control over the identities" really means? Can we learn more about what would be searched FOR and what it would be replaced WITH?

Brian
Go to Top of Page
   

- Advertisement -