Sunday 17 April 2011

ASE : Script to generate bcp out for all tables

As DBA, we are asked to export tables quite often, to speed up the process, also for our own benefit, I wrote a small korn shell script to do the job.

isql -Usa -P -w 1000 <> bcp.ksh
use
go
set nocount on
select "echo bcping table "+ name+char(10)+ "bcp ..'" + name + "' out '"+name+".bcp' -c -Usa -P -t''"from sysobjectswhere type = 'U'
go
EOF

#Can be enhanced to interactively ask for values of loginId, Password, ServerName, dbName and export location

No comments:

Post a Comment