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 |
palaparu
Starting Member
20 Posts |
Posted - 2010-10-28 : 12:31:33
|
How to Export a Database source db : 5 tables each with 1 million rowsDestination : 5 tables each with top 10,000 rowscan any one help |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-10-28 : 12:40:11
|
one time shot? use import/export wizard.if it needs to run periodically, use SSIS and schedule it via sql agent job |
 |
|
palaparu
Starting Member
20 Posts |
Posted - 2010-10-28 : 12:50:28
|
just i need only top 10,000 rows only in destination not 1 million rows |
 |
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-10-28 : 13:02:44
|
[code]DECLARE @n int ; SET @n = 10000DECLARE @fn varchar(50) ; SET @fn = 'D:\'SELECT 'bcp SELECT TOP ' + CONVERT(varchar(25),@n) + ' * FROM ' + TABLE_CATALOG + '.' + TABLE_SCHEMA + '.' + TABLE_NAME + ' queryout ' + @fn + TABLE_CATALOG + '_' + TABLE_SCHEMA + '_' + TABLE_NAME + '_' + CONVERT(varchar(25),@n)+'.dat'FROM INFORMATION_SCHEMA.TablesWHERE TABLE_TYPE = 'BASE TABLE'[/code]Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxWant to help yourself?http://msdn.microsoft.com/en-us/library/ms130214.aspx |
 |
|
|
|
|