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 |
|
asafg
Starting Member
39 Posts |
Posted - 2008-12-14 : 10:53:25
|
HiIn Microsoft SQL Management Studio the studio generated for me the script that can create the view I'm looking at:I right click the view and then> Script view as > Create To > New Query Editor Window.and then I see the script e.g.USE [DB_TEST]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE VIEW [dbo].[V_Test]AS SELECT * FROM DB_TEST.dbo.TABLE_TEST How can I get the same result using codewhithout the studio help something like :select ViewSource from viewsSources |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-14 : 11:05:32
|
| use sp_helptext 'Viewname' |
 |
|
|
asafg
Starting Member
39 Posts |
Posted - 2008-12-14 : 11:31:31
|
thanks very muchI need the text resultand after you showed my the wayThis guy gave me an excellent idea:exec sp_helptext 'sp_helptext' from:http://joseph.randomnetworks.com/archives/tag/sp_helptext/I would prefer to just get a table - because I dont know how to work with stored procedures result- it there are any...but the good side is that I'll have to learn ;)So thanks againAsaf |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-14 : 11:42:08
|
| Your question is not clear as what you need. |
 |
|
|
asafg
Starting Member
39 Posts |
Posted - 2008-12-14 : 11:52:01
|
| What I really need is a query (or a call to stored procedure/function) that return the same result I get using the sp_helptext as a string or more likely as a table.I want to display the text in a textbox.I am using c# and I send queries to the DB which returns strings and mostly tables.I know that there is a way to work with stored procedure but I never tried it before...but this is out of the scope of this forum - and you sure helped me a lot.From this point I will find the solution.Thanks |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-14 : 11:58:52
|
| Ok. You are looking for this.create table #temp(text varchar(max))Insert #tempExec sp_helptext 'viewname'select * from #temp |
 |
|
|
|
|
|