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.
| Author |
Topic |
|
samee
Starting Member
15 Posts |
Posted - 2005-02-08 : 22:30:30
|
| Hi all,There is a export import wizard in sql server and I have used it.What I need to know is the sql command code to do all the importing and exportingThank You.JKNIGHT |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-02-08 : 22:36:05
|
| The wizard will allow you to save a dts package which you can run using dtsrun.exe.You can also use bcp to import and export if you are using text files.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
samee
Starting Member
15 Posts |
Posted - 2005-02-11 : 01:17:50
|
| ThanksBut what i need is the sql code for importing and exporting okThank You.JKNIGHT |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-02-11 : 01:40:41
|
| Export to fileexec xp_cmdshell 'bcp "select * from dbName..tableName" queryout "D:\file.txt" -c'Import from Filebulk insert TableName from 'D:\file.txt'WITH ( DATAFILETYPE = 'char', FIELDTERMINATOR = ' ', TABLOCK)Madhivanan |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-02-11 : 02:13:13
|
| http://www.mindsdoor.net/SQLTsql/BCP_quoted_CSV_Format_file.htmlhttp://www.mindsdoor.net/SQLTsql/ImportTextFiles.htmlhttp://www.mindsdoor.net/SQLTsql/WriteTextFile.html==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
samee
Starting Member
15 Posts |
Posted - 2005-02-11 : 06:27:03
|
| Thanks a LotSo it is possible to export and import from and to any format like this What i need is export and import to excelThank You.JKNIGHT |
 |
|
|
amardesai13
Starting Member
4 Posts |
Posted - 2005-02-11 : 17:01:41
|
| If you really wants to actual sql query who does import export...Then follow this step...The package you have designed from SQL server try to save as visual basic file and then it will create files in Modules.. Then open this module with Visual Basic and you will see sql query which does import export things..Another words just create a package in sql server which import/export data from sql server to excel then save as your package as visual basic file...I hope that helps...ADesai |
 |
|
|
|
|
|