This is a totally newbie question, but...
I've create a database, I'm able to script the schema to a query window, file, etc.
I can't for the life of me find out how to export my data so that it is scripted into insert statements. The data is standardized lists of data I will be distributing with the DB.
For those of you familiar with mySQL, this would be the output of the mysqldump command which dumps schema and data all into one file
mysqldumb <db> -u user -p > mydatafile.txt
thanks,
-David
You won't be able to export it to INSERT statements, but it can be exported to a flatfile with column and row delimiters. Please see Books Online topic bcp utility.
|||Greg-
Ok, I'm familiar with BCP, was just trying to figure out a better way. I'll use BCP and either DTS or write a perl script to parse my data into scripted insert statements.
Thanks,
-David
|||Well, you can always use TSQL to generate it for you as well, and save the results as a file. This can be expensive if your table is huge. Here's one example:
select 'INSERT into dbo.t1 (col1, col2, col3) values (''' + col1 + ''', ''' + col2 + ''', ' + cast(col3 as varchar(10)) + ')'
from dbo.t1
No comments:
Post a Comment