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
 General SQL Server Forums
 Script Library
 Script out a view or proc

Author  Topic 

dvanatta
Starting Member

6 Posts

Posted - 2009-06-03 : 18:29:38
I want to create a HotKey which calls a script which scripts out the stored proc, view, or table which I have highlighted.

Can anyone point me to a scrip which will take a parameter of proc, view, or table and script it out?

Thanks

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2009-06-03 : 23:11:36
Just right click on the object in Enterprise Manager (2000) or Management Studio (2005) and select the script option you want.
Go to Top of Page

dvanatta
Starting Member

6 Posts

Posted - 2009-06-04 : 09:25:23
My goal is to programatically script out just like right-clicking does.

Thanks
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-06-04 : 09:44:03
run profiler and see how EM or SSMS do it


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

dvanatta
Starting Member

6 Posts

Posted - 2009-06-04 : 10:27:52
Great suggestion. Using the profiler I now see where to select the text of a view/store proc. What the profiler is not capturing is how to open a new query window and send that text to it.

Can someone suggest how to programatically open a new Query Window and display text from a query?

Thanks.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-06-04 : 10:32:58
quote:
Originally posted by dvanatta

Great suggestion. Using the profiler I now see where to select the text of a view/store proc. What the profiler is not capturing is how to open a new query window and send that text to it.

Can someone suggest how to programatically open a new Query Window and display text from a query?

Thanks.



Of-course it doesn't. That is not a query. Why are you re-inventing the wheel ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

dvanatta
Starting Member

6 Posts

Posted - 2009-06-04 : 10:44:44
Long story.... Thanks for your help.
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2009-06-05 : 21:12:09
This will probably be helpful
http://www.ssmstoolspack.com/
Go to Top of Page
   

- Advertisement -