Vikrant More
Vikrant More

Reputation: 5442

How to run stored procedure if it's in a separate schema

I am using SQL Server 2008 R2, and I have created a schema Test and in that schema, I created a stored procedure.

I wanted to run it in the text mode by issuing this query:

EXEC SP_HELPTEXT SCHEMA.SPROC

But while running the above query I get this error:

Incorrect syntax near '.'.

Can someone please help me here to resolve this issue.

Upvotes: 21

Views: 11723

Answers (2)

himanshu
himanshu

Reputation: 41

sp_helptext to display the result when sp's or any other tsql binded scripts run without schema, for example:

sp_helptext <nameof sp>

but when you want to run it with schema name as initial then run it into single quotes

sp_helptext 'schma.<nameofsp>

Upvotes: 4

Preet Sangha
Preet Sangha

Reputation: 65496

Try this

EXEC SP_HELPTEXT 'SCHEMA.SPROC'

Upvotes: 25

Related Questions