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
 New to SQL Server Programming
 How to get [dbo].tablename for the tables in sp??

Author  Topic 

Srujan4994
Starting Member

7 Posts

Posted - 2015-01-12 : 02:12:12
Hello everyone,

I am having various views and stored procedures in my database.During scripting the stored procedures/views is there any method or way to include [dbo].table_name used inside the views or procedures??

for example i have a stored procedure p_test.
create proc p_test
as
select a.col1,b.col2 from table a join table b on a.col3 = b.col3

When i script out the procedure script should be in the following way.

create proc [dbo].p_test
as
select a.col1,b.col2 from [dbo].table a join [dbo.]table b on a.col3 = b.col3

is there any solution for this?? Thanks in advance.

Thanks,
Srujan

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-01-12 : 09:06:50
You can use tasks/generate scripts to get SQL to write all the procs to a file (or files). After that, you'll need to edit those statements. If you open the script in SSMS, use find/replace to do what you want. Tedious, I know.
Go to Top of Page

Srujan4994
Starting Member

7 Posts

Posted - 2015-01-13 : 05:42:07
Thanks for the suggestion.. As u said its tedious.. do u have any work around for this?

Thanks,
Srujan
Go to Top of Page
   

- Advertisement -