|
|
| |

Import/Export Scripts
Disclaimer: Use these scripts at your own risk. All information on these
pages is provided "AS IS", without any warranty. MSSQLCity.Com shall not be
liable for any damages you may sustain by using this information.
DataAsInsCommand
Version: SQL Server 7.0/2000
Created by: Alexander Chigrik
http://www.MSSQLCity.com/ - all about MS SQL
(SQL Server Articles, FAQ, Scripts, Tips and Test Exams).
This script will generate insert statements for the given tables. You can pass
the tables names into DataAsInsCommand stored procedure separated by commas,
as in the example below:
EXEC DataAsInsCommand 'employee,titleauthor,pub_info'
|
ExportToExcel
Version: SQL Server 7.0/2000
Created by: Alexander Chigrik
http://www.MSSQLCity.com/ - all about MS SQL
(SQL Server Articles, FAQ, Scripts, Tips and Test Exams).
This stored procedure can be used to insert the result set of the particular
select statement into Excel file (c:\ImportToExcel.xls, by default).
You can pass the server name, user name, user password, the select statement
to execute, and the file name to store the results set, as in the example below:
EXEC ExportToExcel @server = '.',
@uname = 'sa',
@QueryText = 'SELECT au_fname FROM pubs..authors',
@filename = 'c:\ImportToExcel.xls'
|
ExportToWord
Version: SQL Server 7.0/2000
Created by: Alexander Chigrik
http://www.MSSQLCity.com/ - all about MS SQL
(SQL Server Articles, FAQ, Scripts, Tips and Test Exams).
This stored procedure can be used to export the text string into Microsoft Word.
You can pass the text string and the file name (if the file name was not
specified, the c:\ImportToWord.doc will be used) into this stored procedure,
as in the example below:
EXEC ExportToWord @Text = 'Test example',
@filename = 'c:\ImportToWord.doc'
|
|
|
|