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
 Other Forums
 SQL Server 6.5 \ SQL Server 7.0
 export view

Author  Topic 

Steel_m
Starting Member

25 Posts

Posted - 2008-11-27 : 08:32:05
Hi everybody. Having a little problem. I have 2 huge tables. And created a view to join a few feilds between the two. By problem is that i would like to know how to export this view to notepad. Its going to have about 1.5 million rows containg no more than 25 feilds.

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2008-11-27 : 08:41:19
Have you tried usingt bcp for this ?
Go to Top of Page

Steel_m
Starting Member

25 Posts

Posted - 2008-11-27 : 09:09:57
I only see examples where they use bcp to export tables. How would i apply it to a view.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-27 : 09:13:37
Are you using SQL 7.0 or 6.5? I think 7.0 has export/Import wizard. You can put the query in it and export it to text files. You can do with bcp in 6.5.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-27 : 09:23:06
Put the body of view (SQL statements) in bcp.
Go to Top of Page

Steel_m
Starting Member

25 Posts

Posted - 2008-11-27 : 10:30:54
7.0. SO you saying my only option is to place the view in a table then do the export. Cas i only see the import/export option on tables.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-27 : 10:33:03
Put the query that is used in the view like

select.....from so so join po po ......

in Export/Import wizard in the 7.0.
Go to Top of Page

Steel_m
Starting Member

25 Posts

Posted - 2008-11-27 : 10:34:22
i read the syntax from msdn website but it is still a little unclear. The bcp method sounds like the way to go though, where would i put my view statment in the bcp ?
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-27 : 10:44:42
Then use DTS packages.

Suppose I have a view like:

Create view dbo.vwdb
as

select ......


Then put above SQL Statement in green in Execute SQL task
and flat file destination .
Go to Top of Page

Steel_m
Starting Member

25 Posts

Posted - 2008-11-27 : 10:50:46
hey, I tried putting the code for my view in the export using query and it worked. Thanks alot. I tried using about 10 rows. Hope i get the same result with 1 milion.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-27 : 10:52:29
It will work. Did you have Turkey ?
Go to Top of Page

Steel_m
Starting Member

25 Posts

Posted - 2008-11-27 : 11:07:53
I will have to wait until christmas . We dont celebrate thanks giving in the caribbean.
Go to Top of Page
   

- Advertisement -