How we can Create a .SQL File for the Store Procedure in SQL Server 2005?

 Posted by Lakhangarg on 10/27/2009 | Category: Sql Server Interview questions | Views: 1959

Using sqlcmd utility we can create a .sql file for the StoreProcedure.

Sample Code To Create file:
Suppose the name of the procedure is: proc_GetUserList_sp
DB UserName/Password: sa/sa
Server name=MyServer
Database Name: UserDB

Command From Above data is:
sqlcmd -U sa -P sa -S MyServer -d UserDB -Q "exec sp_helptext proc_GetUserList_sp" -h-1 -k 1 >> c:\DB\proc_GetUserList_sp.sql

Thanks & Regards
Lakhan Pal Garg

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response