How to generate ' create table script
' using only tsql
for all the tables in a database.
Format of script should be same as we generate using Microsoft studio 2012
I am using freeTDS
tool in Linux machine to access sql server
.
Try this tool that comes with FreeTDS defncopy
usage: defncopy [-U username] [-P password] [-S servername] [-D database] [-i input filename] [-o output filename] [owner.]object_name [[owner.]object_name...]
Example would be
defncopy -S SERVERINSTANCE -U Username -P SomePass -D '[NAME-OF-THE-DB]' '[schema].[Table]' > Table.sql
This will produce complete create statement along with statements for any constraints and indexes that are part of the table.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.