I am using ArcGIS 10.1 and am a newbie in Python. Currently we are executing stored procedure (from sql server) through ArcPy in ArcMap. I want to create feature class from executing following python script.I researched on Google but unable to find proper way/parameter in ArcPy. Currently going through following parameters GetParameter & GetMessageAny help/steps will be great!My ArcPy Script :import sys
import arcpy
from arcpy import env
try:
# Make data path relative
arcpy.env.workspace = sys.path[0]
# Two ways to create the object, which also creates the
# connection to ArcSDE.
# Using the first method, pass a set of strings containing
# the connection properties:
# <serverName>, <portNumber>, <version>, <userName>, <password>
# arcpy.ArcSDESQLExecute("locolhost","5151","#","Admin","password")
# Using the second method pass the path to a valid ArcSDE connection file
sde_conn = arcpy.ArcSDESQLExecute(r"C:\Users\Administrator\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog\test.sde")
# Get the SQL statements, separated by ; from a text string.
#sql_statement = 'select Name from all_points'
sql_statement = 'Exec [dbo].[sp_test]'
sql_statement_list = sql_statement.split(";")
print("+++++++++++++++++++++++++++++++++++++++++++++\n")
# For each SQL statement passed in, execute it.
for sql in sql_statement_list:
print("Execute SQL Statement: {0}".format(sql))
try:
# Pass the SQL statement to the database.
sde_return = sde_conn.execute(sql)
except Exception as err:
print(err)
sde_return = False
# If the return value is a list (a list of lists), display
# each list as a row from the table being queried.
if isinstance(sde_return, list):
print("Number of rows returned by query: {0} rows".format(
len(sde_return)))
for row in sde_return:
print(row)
print("+++++++++++++++++++++++++++++++++++++++++++++\n")
else:
# If the return value was not a list, the statement was
# most likely a DDL statment. Check its status.
if sde_return == True:
print("SQL statement: {0} ran successfully.".format(sql))
else:
print("SQL statement: {0} FAILED.".format(sql))
print("+++++++++++++++++++++++++++++++++++++++++++++\n")