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.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Exporting Data

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-07-22 : 07:39:44
techbrain writes "Is there a way to export data from Tables through procedures. If How ?"

X002548
Not Just a Number

15586 Posts

Posted - 2003-07-22 : 10:49:49
How about a whole database:


Declare @Path varchar(255), @Server varchar(255), @dbName varchar(255)

Select @Path = 'd:\'
, @Server = @@SERVERNAME
, @dbName = db_name()



Select 'EXEC master..xp_cmdshell '
+ '"bcp ' + @dbName + '..' +o.Name
+ ' out '
+ RTrim(@Path)
+ o.Name+'.out'
+ ' /n /U sa /P /S'+ RTrim(@Server) + '"'
From sysobjects o
Where type = 'U'





Brett

8-)
Go to Top of Page
   

- Advertisement -